@damoqiongqiu/ice-chart 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -22,4 +22,4 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- "use strict";var e=require("ice-render");function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function _callSuper(e,t,i){return t=_getPrototypeOf(t),function _possibleConstructorReturn(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,_isNativeReflectConstruct()?Reflect.construct(t,i||[],_getPrototypeOf(e).constructor):t.apply(e,i))}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_toPropertyKey(r.key),r)}}function _createClass(e,t,i){return t&&_defineProperties(e.prototype,t),i&&_defineProperties(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function _createForOfIteratorHelper(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var r=0,F=function(){};return{s:F,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,a=!0,o=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){o=!0,n=e},f:function(){try{a||null==i.return||i.return()}finally{if(o)throw n}}}}function _defineProperty(e,t,i){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var r=function _superPropBase(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}(e,t);if(r){var n=Object.getOwnPropertyDescriptor(r,t);return n.get?n.get.call(arguments.length<3?e:i):n.value}},_get.apply(null,arguments)}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_isNativeReflectConstruct=function(){return!!e})()}function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(i),!0).forEach(function(t){_defineProperty(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,n,a,o,s=[],l=!0,h=!1;try{if(a=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;l=!1}else for(;!(l=(r=a.call(i)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){h=!0,n=e}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw n}}return s}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _superPropGet(e,t,i,r){var n=_get(_getPrototypeOf(1&r?e.prototype:e),t,i);return 2&r&&"function"==typeof n?function(e){return n.apply(i,e)}:n}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){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 _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _wrapNativeSuper(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(e){if(null===e||!function _isNativeFunction(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,Wrapper)}function Wrapper(){return function _construct(e,t,i){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var n=new(e.bind.apply(e,r));return i&&_setPrototypeOf(n,i.prototype),n}(e,arguments,_getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(e.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,e)},_wrapNativeSuper(e)}var t=_toConsumableArray(e.FAMILY_PALETTE),i={primary:"#0D6EFD",secondary:"#6C757D",success:"#198754",danger:"#DC3545",warning:"#FFC107",info:"#0DCAF0",light:"#F8F9FA",dark:"#212529",indigo:"#6610F2",purple:"#6F42C1",pink:"#D63384",orange:"#FD7E14",teal:"#20C997",cyan:"#0DCAF0",gray:{100:"#F8F9FA",200:"#E9ECEF",300:"#DEE2E6",400:"#CED4DA",500:"#ADB5BD",600:"#6C757D",700:"#495057",800:"#343A40",900:"#212529"},fontFamily:'system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif',radius:6},r=i,n={backgroundColor:"transparent",colorPalette:t,textColor:r.dark,subTextColor:r.secondary,axisLineColor:r.gray[300],axisLabelColor:r.gray[600],splitLineColor:r.gray[200],labelHaloColor:"rgba(255,255,255,0.85)",fontFamily:r.fontFamily,fontSize:12,legend:{textColor:r.gray[700],inactiveColor:r.gray[400]},tooltip:{background:"#ffffff",borderColor:r.gray[300],textColor:r.dark,shadowColor:"rgba(33,37,41,0.18)",fontSize:12,padding:10,radius:r.radius},crosshair:{lineColor:r.gray[500],labelBackground:r.gray[700],labelColor:"#ffffff"},brush:{fill:"rgba(13,110,253,0.16)",stroke:"rgba(13,110,253,0.8)"},selection:{stroke:r.primary,dimOpacity:.3}},a={backgroundColor:"transparent",colorPalette:_toConsumableArray(e.FAMILY_PALETTE_DARK),textColor:r.gray[200],subTextColor:r.gray[500],axisLineColor:r.gray[700],axisLabelColor:r.gray[400],splitLineColor:r.gray[800],labelHaloColor:"rgba(10,18,32,0.88)",fontFamily:r.fontFamily,fontSize:12,legend:{textColor:r.gray[300],inactiveColor:r.gray[700]},tooltip:{background:r.gray[800],borderColor:r.gray[700],textColor:r.gray[100],shadowColor:"rgba(0,0,0,0.5)",fontSize:12,padding:10,radius:r.radius},crosshair:{lineColor:r.gray[600],labelBackground:r.gray[300],labelColor:r.dark},brush:{fill:"rgba(77,148,255,0.2)",stroke:"rgba(77,148,255,0.85)"},selection:{stroke:"#4D94FF",dimOpacity:.32}},o=n,s=a;function resolveChartTheme(e){var t="dark"===e||"auto"===e&&(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preferDark?a:n;return e&&"string"!=typeof e?_objectSpread2(_objectSpread2(_objectSpread2({},t),e),{},{legend:_objectSpread2(_objectSpread2({},t.legend),e.legend||{}),tooltip:_objectSpread2(_objectSpread2({},t.tooltip),e.tooltip||{}),crosshair:_objectSpread2(_objectSpread2({},t.crosshair),e.crosshair||{}),brush:_objectSpread2(_objectSpread2({},t.brush),e.brush||{}),selection:_objectSpread2(_objectSpread2({},t.selection),e.selection||{})}):t}function clamp$2(e,t,i){return e<t?t:e>i?i:e}function isFiniteNumber(e){return"number"==typeof e&&isFinite(e)}function extent(e){for(var t=1/0,i=-1/0,r=0;r<e.length;r++){var n=e[r];isFiniteNumber(n)&&(n<t&&(t=n),n>i&&(i=n))}if(t===1/0)return[0,1];if(t===i){var a=Math.abs(t)>1?.1*Math.abs(t):1;return[t-a,i+a]}return[t,i]}function niceStep(e,t){if(!(e>0&&t>0))return 1;var i=e/t,r=Math.pow(10,Math.floor(Math.log10(i))),n=i/r;return(n>=5?10:n>=2?5:n>=1?2:1)*r}function niceDomain(e,t){var i=_slicedToArray(e,2),r=i[0],n=i[1],a=niceStep(n-r,t);return[Math.floor(r/a)*a,Math.ceil(n/a)*a]}function round(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,i=Math.pow(10,t);return Math.round(e*i)/i}var l=1e3,h=6e4,u=36e5,c=24*u,d=30*c,f=365*c;function makeInterval(e,t,i,r,n){return{unit:e,ms:t*i,floor:function floor(e){var t=new Date(e);return r(t),t.getTime()},next:function next(e){var t=new Date(e);return n(t),t.getTime()}}}var p=[makeInterval("ms",1,1,function(){},function(e){return e.setUTCMilliseconds(e.getUTCMilliseconds()+1)}),makeInterval("ms",10,1,function(e){return e.setUTCMilliseconds(10*Math.floor(e.getUTCMilliseconds()/10))},function(e){return e.setUTCMilliseconds(e.getUTCMilliseconds()+10)}),makeInterval("ms",100,1,function(e){return e.setUTCMilliseconds(100*Math.floor(e.getUTCMilliseconds()/100))},function(e){return e.setUTCMilliseconds(e.getUTCMilliseconds()+100)}),makeInterval("s",1,l,function(e){return e.setUTCMilliseconds(0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+1)}),makeInterval("s",5,l,function(e){return e.setUTCSeconds(5*Math.floor(e.getUTCSeconds()/5),0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+5)}),makeInterval("s",15,l,function(e){return e.setUTCSeconds(15*Math.floor(e.getUTCSeconds()/15),0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+15)}),makeInterval("s",30,l,function(e){return e.setUTCSeconds(30*Math.floor(e.getUTCSeconds()/30),0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+30)}),makeInterval("m",1,h,function(e){return e.setUTCSeconds(0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+1)}),makeInterval("m",5,h,function(e){return e.setUTCMinutes(5*Math.floor(e.getUTCMinutes()/5),0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+5)}),makeInterval("m",15,h,function(e){return e.setUTCMinutes(15*Math.floor(e.getUTCMinutes()/15),0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+15)}),makeInterval("m",30,h,function(e){return e.setUTCMinutes(30*Math.floor(e.getUTCMinutes()/30),0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+30)}),makeInterval("h",1,u,function(e){return e.setUTCMinutes(0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+1)}),makeInterval("h",3,u,function(e){return e.setUTCHours(3*Math.floor(e.getUTCHours()/3),0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+3)}),makeInterval("h",6,u,function(e){return e.setUTCHours(6*Math.floor(e.getUTCHours()/6),0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+6)}),makeInterval("h",12,u,function(e){return e.setUTCHours(12*Math.floor(e.getUTCHours()/12),0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+12)}),makeInterval("d",1,c,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCDate(e.getUTCDate()+1)}),makeInterval("d",2,c,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCDate(e.getUTCDate()+2)}),makeInterval("d",7,c,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCDate(e.getUTCDate()+7)}),makeInterval("mo",1,d,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCMonth(e.getUTCMonth()+1)}),makeInterval("mo",3,d,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCMonth(e.getUTCMonth()+3)}),makeInterval("y",1,f,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCFullYear(e.getUTCFullYear()+1)})];function pad(e){return e<10?"0".concat(e):String(e)}var v=function(){function TimeScale(e,t){_classCallCheck(this,TimeScale),_defineProperty(this,"type","time");var i=Number(e[0]),r=Number(e[1]);this.domain=i===r?[i-c,r+c]:[Math.min(i,r),Math.max(i,r)],this.range=t}return _createClass(TimeScale,[{key:"map",value:function map(e){var t=toTimestamp(e),i=_slicedToArray(this.domain,2),r=i[0],n=i[1],a=_slicedToArray(this.range,2),o=a[0];return o+(t-r)/(n-r)*(a[1]-o)}},{key:"invert",value:function invert(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=_slicedToArray(this.range,2),a=n[0],o=n[1];return o===a?i:i+(e-a)/(o-a)*(r-i)}},{key:"pickInterval",value:function pickInterval(e){for(var t=(this.domain[1]-this.domain[0])/Math.max(1,e),i=p[0],r=1/0,n=0;n<p.length;n++){var a=Math.abs(Math.log(p[n].ms/t));a<r&&(r=a,i=p[n])}return i}},{key:"ticks",value:function ticks(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=this.pickInterval(e),i=[],r=t.floor(this.domain[0]);r<this.domain[0]&&(r=t.next(r));for(var n=0;r<=this.domain[1]&&n<1e3;n++){i.push(r);var a=t.next(r);if(a===r)break;r=a}return i}},{key:"bandwidth",value:function bandwidth(){return 0}},{key:"bandStart",value:function bandStart(e){return this.map(e)}},{key:"step",value:function step(){return this.pickInterval(5).ms}},{key:"isBand",value:function isBand(){return!1}},{key:"indexAt",value:function indexAt(e){return-1}},{key:"fractionOf",value:function fractionOf(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1];return r===i?0:(toTimestamp(e)-i)/(r-i)}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=_slicedToArray(this.domain,2),i=t[0];return i+e*(t[1]-i)}},{key:"span",value:function span(){return this.domain[1]-this.domain[0]}},{key:"format",value:function format(e,t){return function formatTime(e,t,i){var r=new Date(e),n=pad(r.getUTCHours()),a=pad(r.getUTCMinutes()),o=pad(r.getUTCSeconds()),s=pad(r.getUTCMonth()+1),l=pad(r.getUTCDate()),h=r.getUTCFullYear(),u=i>3*f;switch(t){case"ms":return"".concat(n,":").concat(a,":").concat(o,".").concat(pad(r.getUTCMilliseconds()));case"s":return"".concat(n,":").concat(a,":").concat(o);case"m":return"".concat(n,":").concat(a);case"h":return"".concat(n,":00");case"d":return u?"".concat(h,"-").concat(s,"-").concat(l):"".concat(s,"-").concat(l);case"mo":return u?"".concat(h,"-").concat(s):"".concat(s,"-01");default:return"".concat(h)}}(toTimestamp(e),this.pickInterval(5).unit,this.span())}},{key:"clone",value:function clone(){return new TimeScale([this.domain[0],this.domain[1]],[this.range[0],this.range[1]])}}])}();function toTimestamp(e){if(e instanceof Date)return e.getTime();if("string"==typeof e){var t=Date.parse(e);if(!isNaN(t))return t}var i=Number(e);return isFinite(i)?i:NaN}var m=function(){function ExpressionError(e,t,i){var r,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"syntax";return _classCallCheck(this,ExpressionError),(r=_callSuper(this,ExpressionError,["[ice-chart] 表达式错误:".concat(e,"(位置 ").concat(t,")\n ").concat(i,"\n ").concat(" ".repeat(Math.max(0,t)),"^")])).name="ExpressionError",r.position=t,r.code=n,r}return _inherits(ExpressionError,_wrapNativeSuper(Error)),_createClass(ExpressionError)}(),g={pi:Math.PI,PI:Math.PI,e:Math.E,tau:2*Math.PI,TAU:2*Math.PI,inf:1/0,Infinity:1/0,nan:NaN},b={sin:1,cos:1,tan:1,asin:1,acos:1,atan:1,atan2:2,sinh:1,cosh:1,tanh:1,asinh:1,acosh:1,atanh:1,exp:1,ln:1,log:1,log2:1,log10:1,sqrt:1,cbrt:1,abs:1,sign:1,floor:1,ceil:1,round:1,trunc:1,min:2,max:2,pow:2,mod:2,hypot:2,clamp:3},k={min:Math.min,max:Math.max,pow:Math.pow,mod:function mod(e,t){return e%t},hypot:Math.hypot,clamp:function clamp(e,t,i){return Math.max(t,Math.min(i,e))},ln:Math.log,log:Math.log,log10:Math.log10,cbrt:Math.cbrt,trunc:Math.trunc,sign:Math.sign};var S=function(){return _createClass(function Parser(e){_classCallCheck(this,Parser),_defineProperty(this,"index",0),_defineProperty(this,"variables",new Set),this.source=e,this.tokens=function tokenize(e){for(var t=[],i=0,r=function isDigit(e){return e>="0"&&e<="9"},n=function isIdentStart(e){return/[A-Za-z_]/.test(e)},a=function isIdentPart(e){return/[A-Za-z0-9_]/.test(e)};i<e.length;){var o=e[i];if(" "!==o&&"\t"!==o&&"\n"!==o&&"\r"!==o)if(r(o)||"."===o&&r(e[i+1]||"")){for(var s=i;i<e.length&&(r(e[i])||"."===e[i]);)i++;if("e"===e[i]||"E"===e[i]){var l=i;if("+"!==e[++i]&&"-"!==e[i]||i++,r(e[i]||""))for(;i<e.length&&r(e[i]);)i++;else i=l}t.push({type:"num",value:e.slice(s,i),position:s})}else if(n(o)){for(var h=i;i<e.length&&a(e[i]);)i++;t.push({type:"ident",value:e.slice(h,i),position:h})}else if("+-*/%^".indexOf(o)>=0)t.push({type:"op",value:o,position:i}),i++;else if("("!==o)if(")"!==o){if(","!==o)throw new m("无法识别的字符「".concat(o,"」"),i,e,"unknown-character");t.push({type:"comma",value:o,position:i}),i++}else t.push({type:"rparen",value:o,position:i}),i++;else t.push({type:"lparen",value:o,position:i}),i++;else i++}return t.push({type:"end",value:"",position:e.length}),t}(e)},[{key:"parse",value:function parse(){if("end"===this.peek().type)throw new m("表达式是空的",0,this.source,"empty");var e=this.parseSum(),t=this.peek();if("end"!==t.type)throw new m("多余的内容「".concat(t.value,"」"),t.position,this.source);return e}},{key:"getVariables",value:function getVariables(){return Array.from(this.variables)}},{key:"peek",value:function peek(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.tokens[Math.min(this.index+e,this.tokens.length-1)]}},{key:"next",value:function next(){return this.tokens[this.index++]}},{key:"parseSum",value:function parseSum(){for(var e=this.parseProduct();;){var t=this.peek();if("op"!==t.type||"+"!==t.value&&"-"!==t.value)return e;this.next(),e={kind:"binary",op:t.value,left:e,right:this.parseProduct()}}}},{key:"parseProduct",value:function parseProduct(){for(var e=this.parseUnary();;){var t=this.peek();if("op"===t.type&&"*/%".indexOf(t.value)>=0)this.next(),e={kind:"binary",op:t.value,left:e,right:this.parseUnary()};else{if(!this.startsAtom(t)||!this.endsAtom(e))return e;e={kind:"binary",op:"*",left:e,right:this.parseUnary()}}}}},{key:"startsAtom",value:function startsAtom(e){return"num"===e.type||"ident"===e.type||"lparen"===e.type}},{key:"endsAtom",value:function endsAtom(e){return"num"===e.kind||"var"===e.kind&&void 0!==g[e.name]}},{key:"parseUnary",value:function parseUnary(){var e=this.peek();return"op"!==e.type||"-"!==e.value&&"+"!==e.value?this.parsePower():(this.next(),{kind:"unary",op:e.value,arg:this.parseUnary()})}},{key:"parsePower",value:function parsePower(){var e=this.parseAtom(),t=this.peek();return"op"===t.type&&"^"===t.value?(this.next(),{kind:"binary",op:"^",left:e,right:this.parseUnary()}):e}},{key:"parseAtom",value:function parseAtom(){var e=this.next();if("num"===e.type){var t=Number(e.value);if(!isFinite(t))throw new m("无法解析的数字「".concat(e.value,"」"),e.position,this.source);return{kind:"num",value:t}}if("lparen"===e.type){var i=this.parseSum(),r=this.peek();if("rparen"!==r.type)throw new m("缺少右括号",r.position,this.source);return this.next(),i}if("ident"===e.type){var n=e.value;if("lparen"===this.peek().type){var a=b[n];if(void 0===a)throw new m("未知函数「".concat(n,"」"),e.position,this.source,"unknown-function");this.next();for(var o=[this.parseSum()];"comma"===this.peek().type;)this.next(),o.push(this.parseSum());var s=this.peek();if("rparen"!==s.type)throw new m("函数「".concat(n,"」缺少右括号"),s.position,this.source);if(this.next(),o.length!==a)throw new m("函数「".concat(n,"」需要 ").concat(a," 个参数,收到 ").concat(o.length," 个"),e.position,this.source,"arity");return{kind:"call",name:n,args:o}}return void 0!==g[n]?{kind:"num",value:g[n]}:(this.variables.add(n),{kind:"var",name:n})}throw new m("end"===e.type?"表达式意外结束":"这里不该出现「".concat(e.value,"」"),e.position,this.source)}}])}();function compileNode(e){switch(e.kind){case"num":return function(){return e.value};case"var":return function(t){var i=t[e.name];return"number"==typeof i?i:NaN};case"unary":var t=compileNode(e.arg);return"-"===e.op?function(e){return-t(e)}:t;case"binary":var i=compileNode(e.left),r=compileNode(e.right);switch(e.op){case"+":return function(e){return i(e)+r(e)};case"-":return function(e){return i(e)-r(e)};case"*":return function(e){return i(e)*r(e)};case"/":return function(e){return i(e)/r(e)};case"%":return function(e){return i(e)%r(e)};case"^":return function(e){return Math.pow(i(e),r(e))};default:return function(){return NaN}}case"call":var n=e.name,a=k[n]||Math[n],o=e.args.map(compileNode);return a?function(e){return a.apply(void 0,_toConsumableArray(o.map(function(t){return t(e)})))}:function(){return NaN}}}var w=new Map;function compileExpression(e){var t=String(null==e?"":e),i=w.get(t);if(i)return i;var r=new S(t),n=compileNode(r.parse()),a={source:t,variables:r.getVariables(),evaluate:function evaluate(e){return n(e||{})}};return w.set(t,a),a}function compileSampler(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=compileExpression(e),r=_objectSpread2({},t);return{setParams:function setParams(e){for(var t=0,i=Object.keys(e);t<i.length;t++){var n=i[t];r[n]=Number(e[n])}},evaluate:function evaluate(e,t){return r[e]=t,i.evaluate(r)}}}function quantile(e,t){return e.length?e[Math.min(e.length-1,Math.max(0,Math.round((e.length-1)*t)))]:NaN}function diagnoseExpression(e,t){var i=String(null==e?"":e),r=t.params||{},n=[];if(!i.trim())return n.push({code:"empty",severity:"error",message:"表达式是空的:请填写 ".concat(t.variable," 的公式,例如 ").concat("t"===t.variable?"sin(3*t)":"sin(x)/x")}),n;var a=[];try{a=compileExpression(i).variables}catch(e){return e instanceof m?(n.push({code:e.code,severity:"error",message:e.message,position:e.position}),n):(n.push({code:"syntax",severity:"error",message:String(e&&e.message?e.message:e)}),n)}var o,s=[t.variable].concat(_toConsumableArray(Object.keys(r))),l=a.filter(function(e){return e!==t.variable&&!(e in r)}),h=_createForOfIteratorHelper(l);try{for(h.s();!(o=h.n()).done;){var u=o.value;n.push({code:"unknown-variable",severity:"error",message:"未定义的变量「".concat(u,"」:可用的是 ").concat(s.join("、"),"。想当参数用请写进 series.params(会自动进 JSON 快照)。")})}}catch(e){h.e(e)}finally{h.f()}var c,d=new Set([].concat(_toConsumableArray(a),_toConsumableArray(t.additionalVariables||[]))),f=Object.keys(r).filter(function(e){return!d.has(e)}),p=_createForOfIteratorHelper(f);try{for(p.s();!(c=p.n()).done;){var v=c.value;n.push({code:"unused-parameter",severity:"warning",message:"参数「".concat(v,"」定义了但表达式没有用到,改公式或去掉它。")})}}catch(e){p.e(e)}finally{p.f()}var g=t.values;if(g&&g.length&&!n.some(function(e){return"error"===e.severity})){var b=g.filter(function(e){return"number"==typeof e&&isFinite(e)});if(b.length){var k=b.slice().sort(function(e,t){return e-t}),S=quantile(k,.02),w=quantile(k,.98);Math.abs(w-S)<1e-12&&n.push({code:"constant-value",severity:"warning",message:"输出恒为 ".concat(Number(w.toPrecision(6)),":函数与自变量无关(或恰好取到常数),画出来是一条水平线。")})}else n.push({code:"no-finite-values",severity:"error",message:"在当前区间内没有任何可绘制的值:检查是否对负数开方、对 0 取对数,或者分母整段为 0。"})}return n}var A=1e7;function robustRange(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=e.filter(function(e){return"number"==typeof e&&isFinite(e)&&Math.abs(e)<A});if(!i.length)return[-1,1];var r=i.slice().sort(function(e,t){return e-t}),n=function at(e){return r[Math.min(r.length-1,Math.max(0,Math.round((r.length-1)*e)))]},a=n(.5),o=n(.75)-n(.25),s=r[0],l=r[r.length-1];if(o>0&&(s=Math.max(s,a-t*o),l=Math.min(l,a+t*o)),!(l>s)){var h=(l+s)/2,u=Math.max(1,.2*Math.abs(h));s=h-u,l=h+u}return[s,l]}function refineSegment(e,t,i,r,n,a,o){var s=(t+r)/2;if(isFinite(s)&&s!==t&&s!==r){var l=e.evaluate(s);if(e.isBreak(l))o.push(s,NaN);else e.adaptive&&a<e.maxDepth&&e.count<e.maxSamples&&!e.isBreak(i)&&!e.isBreak(n)&&e.deviation(i,l,n)>e.tolerance&&(e.count++,refineSegment(e,t,i,s,l,a+1,o),e.emit(s,l,o),refineSegment(e,s,l,r,n,a+1,o))}}function sampleFunctionCurve(e,t,i){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=Math.max(2,Math.round(r.base||240)),a=new Float64Array(n),o=new Float64Array(n),s=0;s<n;s++){var l=t+(i-t)*s/(n-1),h=e(l);a[s]=l,o[s]=isFinite(h)&&Math.abs(h)<A?h:NaN}for(var u=_slicedToArray(robustRange(Array.from(o)),2),c=u[0],d=u[1],f=Math.max(1e-9,d-c),p={tolerance:Math.max(1e-9,(void 0===r.tolerance?.0025:r.tolerance)*f),maxDepth:void 0===r.maxDepth?7:r.maxDepth,maxSamples:void 0===r.maxSamples?6e3:r.maxSamples,count:n,adaptive:!1!==r.adaptive,evaluate:function evaluate(t){return e(t)},isBreak:function isBreak(e){return!isFinite(e)||Math.abs(e)>A},deviation:function deviation(e,t,i){return Math.abs(t-(e+i)/2)},emit:function emit(e,t,i){i.push(e,t)}},v=[],m=0;m<n&&(v.push(a[m],isFinite(o[m])?o[m]:NaN),m!==n-1);m++)refineSegment(p,a[m],o[m],a[m+1],o[m+1],0,v);for(var g=[],b=0;b<v.length;b+=2)g.push([v[b],v[b+1]]);return function breakPoles(e,t){for(var i=20*Math.max(1e-9,t),r=[],n=0;n<e.length;n++){var a=e[n],o=r.length?r[r.length-1]:null;o&&isFinite(o[1])&&isFinite(a[1])&&o[1]*a[1]<0&&Math.abs(a[1]-o[1])>i&&r.push([(o[0]+a[0])/2,NaN]),r.push(a)}return r}(g,f)}function sampleParametricCurve(e,t,i,r){for(var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=Math.max(2,Math.round(n.base||360)),o=new Float64Array(a),s=new Float64Array(a),l=new Float64Array(a),h=0;h<a;h++){var u=i+(r-i)*h/(a-1);o[h]=u,s[h]=e(u),l[h]=t(u)}for(var c=_slicedToArray(robustRange(Array.from(s)),2),d=c[0],f=c[1],p=_slicedToArray(robustRange(Array.from(l)),2),v=p[0],m=p[1],g=Math.max(1e-9,Math.hypot(f-d,m-v)),b={tolerance:Math.max(1e-9,(void 0===n.tolerance?.0015:n.tolerance)*g),maxDepth:void 0===n.maxDepth?7:n.maxDepth,maxSamples:void 0===n.maxSamples?8e3:n.maxSamples,count:a,adaptive:!1!==n.adaptive,evaluate:function evaluate(i){return[e(i),t(i)]},isBreak:function isBreak(e){return!isFinite(e[0])||!isFinite(e[1])||Math.abs(e[0])>A||Math.abs(e[1])>A},deviation:function deviation(e,t,i){return function midDeviation(e,t,i,r,n,a){var o=i-e,s=r-t,l=o*o+s*s;if(0===l)return Math.hypot(n-e,a-t);var h=((n-e)*o+(a-t)*s)/l;return h=Math.max(0,Math.min(1,h)),Math.hypot(n-(e+h*o),a-(t+h*s))}(e[0],e[1],i[0],i[1],t[0],t[1])},emit:function emit(e,t,i){i.push(t[0],t[1])}},k=[],S=0;S<a;S++){var w=s[S],_=l[S],M=!isFinite(w)||!isFinite(_)||Math.abs(w)>A||Math.abs(_)>A;if(k.push(M?NaN:w,M?NaN:_),S===a-1)break;refineSegment(b,o[S],[s[S],l[S]],o[S+1],[s[S+1],l[S+1]],0,k)}for(var C=[],T=0;T<k.length;T+=2)C.push([k[T],k[T+1]]);return C}var _={top:12,right:16,bottom:12,left:12};function padDomain(e,t,i,r,n){var a=i&&void 0!==i.padding?Number(i.padding):.05;if(!isFinite(a)||a<=0)return[e,t];var o=t-e;if(!isFinite(o)||o<=0)return[e,t];var s=o*Math.min(.5,a);return[r?e:e-s,n?t:t+s]}var M={enter:{duration:520,delay:0,easing:"easeOutCubic",stagger:.35},update:{duration:420,delay:0,easing:"easeOutCubic",stagger:0},highlight:{duration:260,delay:0,easing:"springSnappy",stagger:0}};function normalizeAnimation(e){if(!1===e)return{enabled:!1,enter:!1,update:!1,highlight:!1};var t=e||{},i=!1!==t.enabled,r={duration:t.duration,easing:t.easing,stagger:t.stagger,delay:t.delay},n=function stage(e){if(!1===t[e])return!1;var i=_objectSpread2({},M[e]);if("enter"===e)for(var n=0,a=Object.keys(r);n<a.length;n++){var o=a[n];void 0!==r[o]&&(i[o]=r[o])}return t[e]&&"object"===_typeof(t[e])&&Object.assign(i,t[e]),i};return{enabled:i,enter:n("enter"),update:n("update"),highlight:n("highlight")}}function normalizeAnnotation(e){if(!e||"object"!==_typeof(e))return null;var t=function list(e){return Array.isArray(e)?e.filter(function(e){return e&&"object"===_typeof(e)}):[]},i=t(e.lines),r=t(e.points),n=t(e.areas);return i.length||r.length||n.length?{lines:i,points:r,areas:n}:null}function normalizeOption(e){var t,i,r,n,a,o,s,l,h,u,c,d,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||!Array.isArray(e.series))throw new Error("[ice-chart] option.series 必须是数组。");var p=resolveChartTheme(e.theme,{preferDark:!!f.preferDark}),v={legend:_objectSpread2({show:e.series.length>1,position:"top",itemWidth:12,itemHeight:12,itemGap:16,selectable:!0},e.legend||{}),tooltip:_objectSpread2({show:!0,trigger:"axis"},e.tooltip||{}),crosshair:_objectSpread2({show:!0,type:"line",axis:"x",showAxisLabel:!0},e.crosshair||{}),grid:_objectSpread2({show:!0,x:!1,y:!0,lineWidth:1},e.grid||{}),interaction:{hover:_objectSpread2({enabled:!0,mode:"nearest-x",dimOthers:!1},(null===(t=e.interaction)||void 0===t?void 0:t.hover)||{}),select:_objectSpread2({enabled:!1,mode:"single",toggle:!0},(null===(i=e.interaction)||void 0===i?void 0:i.select)||{}),brush:!1!==(null===(r=e.interaction)||void 0===r?void 0:r.brush)&&_objectSpread2({enabled:!1,axes:"x",mode:"select"},(null===(n=e.interaction)||void 0===n?void 0:n.brush)||{}),zoom:!1!==(null===(a=e.interaction)||void 0===a?void 0:a.zoom)&&_objectSpread2({enabled:!0,axes:"x",wheel:!0,wheelFactor:1.2,mode:"data"},(null===(o=e.interaction)||void 0===o?void 0:o.zoom)||{}),pan:!1!==(null===(s=e.interaction)||void 0===s?void 0:s.pan)&&_objectSpread2({enabled:!1,axes:"xy"},(null===(l=e.interaction)||void 0===l?void 0:l.pan)||{}),keyboard:void 0===(null===(h=e.interaction)||void 0===h?void 0:h.keyboard)||e.interaction.keyboard},animation:normalizeAnimation(e.animation),margin:_objectSpread2(_objectSpread2({},_),e.margin||{})};v.series=e.series,v.title=e.title,v.xAxis=e.xAxis||{},v.yAxis=e.yAxis||{},v.dataZoom=e.dataZoom||null,v.theme=e.theme,v.aspect="equal"===e.aspect?"equal":"auto",v.polarGrid=e.polarGrid||null,v.annotation=normalizeAnnotation(e.annotation),v.tooltip=_objectSpread2({show:!1!==(null===(u=e.tooltip)||void 0===u?void 0:u.show)},v.tooltip),v.crosshair=_objectSpread2({show:!1!==(null===(c=e.crosshair)||void 0===c?void 0:c.show)},v.crosshair);for(var m=e.radar||null,g=e.graph||null,b=function buildSeries(e,t,i,r,n,a,o){for(var s=[],l={},h=0;h<e.length;h++){var u=e[h];if(!u||!u.type)throw new Error("[ice-chart] series[".concat(h,"] 缺少 type。"));var c=u.name;c||(c="series-".concat(h+1)),void 0!==l[c]?(l[c]+=1,c="".concat(c," (").concat(l[c],")")):l[c]=0;var d=u.id||"series-".concat(h),f=u.color||t.colorPalette[h%t.colorPalette.length],p=buildPoints(u,r,n,a,o),v=p.points,m=p.hasExplicitX;if("pie"===u.type)for(var g=0;g<v.length;g++){var b=v[g].raw,k=b&&"object"===_typeof(b)&&!Array.isArray(b)?b.color:void 0;v[g].color=k||(0===g&&u.color?u.color:t.colorPalette[g%t.colorPalette.length])}var S={id:d,index:h,type:u.type,name:c,color:f,option:u,points:v,hasExplicitX:m,hidden:!1,axisIndex:0};applyCurveDomain(S,u),s.push(S)}return s}(e.series,p,null===(d=v.legend)||void 0===d||d.selected,m,e.sankey||null,g,f),k=0,S=b;k<S.length;k++){var w=S[k];if("waterfall"===w.type){var A=w.option.waterfall,M=void 0!==A?A:e.waterfall;void 0!==M&&(w.waterfallOption=M)}}for(var C=_objectSpread2({},f.hiddenIds||{}),T=0,P=b;T<P.length;T++){var I,O=P[T];null!==(I=v.legend)&&void 0!==I&&I.selected&&!1===v.legend.selected[O.name]&&(C[O.id]=!0),O.hidden=!!C[O.id]||!1===O.option.show}var N=b.some(function(e){return"pie"===e.type})?"polar":b.some(function(e){return"radar"===e.type})?"radar":b.some(function(e){return"sankey"===e.type})?"sankey":b.some(function(e){return"funnel"===e.type})?"funnel":b.some(function(e){return"gauge"===e.type})?"gauge":b.some(function(e){return"liquid"===e.type})?"liquid":b.some(function(e){return"treemap"===e.type})?"treemap":b.some(function(e){return"graph"===e.type})?"graph":"cartesian",D="sankey"===N&&e.sankey||null,H="funnel"===N?e.funnel||{}:null,R="gauge"===N?e.gauge||{}:null,E="liquid"===N?e.liquid||{}:null,L="treemap"===N?e.treemap||{}:null,z="graph"===N?g:null,B=_objectSpread2({},f.hiddenSlices||{}),W=m?function buildRadarDomains(e,t){for(var i=[],r=Array.isArray(e.indicators)?e.indicators.length:0,n=0;n<r;n++){var a,o=e.indicators[n]||{name:String(n)},s=-1/0,l=_createForOfIteratorHelper(t);try{for(l.s();!(a=l.n()).done;){var h=a.value;if("radar"===h.type&&!h.hidden){var u=h.points[n];u&&null!==u.y&&u.y>s&&(s=u.y)}}}catch(e){l.e(e)}finally{l.f()}isFinite(s)||(s=1);var c=isFiniteNumber(o.min)?o.min:0,d=isFiniteNumber(o.max)?o.max:s;i.push([c,d>c?d:c+1])}return i}(m,b):[];"cartesian"===N||e.tooltip&&void 0!==e.tooltip.trigger||(v.tooltip.trigger="item");var V=v.xAxis;"value"===V.type&&(V.type="linear");var j=Array.isArray(e.yAxis)?e.yAxis:[e.yAxis||{}];j.length||j.push({});var U,X=_createForOfIteratorHelper(j);try{for(X.s();!(U=X.n()).done;){var K=U.value;"value"===K.type&&(K.type="linear")}}catch(e){X.e(e)}finally{X.f()}for(var G=0,Y=b;G<Y.length;G++){var q=Y[G],$=Number(q.option.yAxisIndex);q.axisIndex=isFinite($)?Math.max(0,Math.min(j.length-1,Math.floor($))):0}var Z=function isHorizontalLayout(e,t){var i="category"===t.type||Array.isArray(t.data)&&t.data.length>0;return!!i&&!("category"===e.type||Array.isArray(e.data)&&e.data.length>0)}(V,j[0]);!Z||e.tooltip&&void 0!==e.tooltip.trigger||(v.tooltip.trigger="item"),function applyAxisCategories(e,t){if(!e||!Array.isArray(e.data)||!e.data.length)return;var i,r=e.data,n=_createForOfIteratorHelper(t);try{for(n.s();!(i=n.n()).done;){var a,o=_createForOfIteratorHelper(i.value.points);try{for(o.s();!(a=o.n()).done;){var s=a.value;s.xValue===s.index&&(void 0!==r[s.index]&&(s.xValue=r[s.index],void 0===s.name&&(s.name=String(r[s.index]))))}}catch(e){o.e(e)}finally{o.f()}}}catch(e){n.e(e)}finally{n.f()}}(Z?j[0]:V,b);var J,Q,ee=Z?V.type&&"category"!==V.type?V.type:"linear":function resolveXAxisType(e,t){if(e.type)return e.type;if(t.some(function(e){return"bar"===e.type||"candlestick"===e.type||"heatmap"===e.type||"boxplot"===e.type||"waterfall"===e.type}))return"category";var i,r=[],n=_createForOfIteratorHelper(t);try{for(n.s();!(i=n.n()).done;){var a,o=_createForOfIteratorHelper(i.value.points);try{for(o.s();!(a=o.n()).done;){var s=a.value;if(r.push(s.xValue),r.length>2e3)break}}catch(e){o.e(e)}finally{o.f()}}}catch(e){n.e(e)}finally{n.f()}if(r.some(function(e){return e instanceof Date}))return"time";if(r.some(function(e){return"number"==typeof e&&Math.abs(e)>1e11}))return"time";if(r.some(function(e){return"string"==typeof e&&!isFinite(Number(e))}))return"category";return"linear"}(V,b);if(Z){J=buildYDomain(b,0,V,ee),Q=[];var te=function buildCategoryValues(e,t){if(Array.isArray(e.data)&&e.data.length)return e.data.slice();var i,r={},n=[],a=_createForOfIteratorHelper(t);try{for(a.s();!(i=a.n()).done;){var o,s=_createForOfIteratorHelper(i.value.points);try{for(s.s();!(o=s.n()).done;){var l=o.value,h=void 0===l.name?l.xValue:l.name,u=String(h);r[u]||(r[u]=!0,n.push(h))}}catch(e){s.e(e)}finally{s.f()}}}catch(e){a.e(e)}finally{a.f()}return n}(j[0],b);j[0]=_objectSpread2(_objectSpread2({},j[0]),{},{type:"category"}),j[0].__categories=te}else{var ie=function buildXDomain(e,t,i){if("category"===e){if(Array.isArray(i.data)&&i.data.length)return{domain:i.data.slice(),categories:i.data.slice()};var r,n={},a=[],o=_createForOfIteratorHelper(t);try{for(o.s();!(r=o.n()).done;){var s,l=_createForOfIteratorHelper(r.value.points);try{for(l.s();!(s=l.n()).done;){var h=s.value,u=String(h.xValue);n[u]||(n[u]=!0,a.push(h.xValue))}}catch(e){l.e(e)}finally{l.f()}}}catch(e){o.e(e)}finally{o.f()}return{domain:a,categories:a}}var c,d=[],f=_createForOfIteratorHelper(t);try{for(f.s();!(c=f.n()).done;){var p=c.value;if(p.domainXValues&&p.domainXValues.length){var v,m=_createForOfIteratorHelper(p.domainXValues);try{for(m.s();!(v=m.n()).done;){var g=v.value;isFinite(g)&&d.push(g)}}catch(e){m.e(e)}finally{m.f()}}else{var b,k=_createForOfIteratorHelper(p.points);try{for(k.s();!(b=k.n()).done;){var S=b.value,w="time"===e?toTimestamp(S.xValue):Number(S.xValue);isFinite(w)&&d.push(w)}}catch(e){k.e(e)}finally{k.f()}}}}catch(e){f.e(e)}finally{f.f()}var A=_slicedToArray(extent(d),2),_=A[0],M=A[1],C=isFiniteNumber(i.min),T=isFiniteNumber(i.max);C&&(_=i.min);T&&(M=i.max);if(!1!==i.nice){var P=_slicedToArray(niceDomain([_,M],i.tickCount||5),2);_=P[0],M=P[1]}if("log"!==e){var I=_slicedToArray(padDomain(_,M,i,C,T),2);_=I[0],M=I[1]}return{domain:[_,M],categories:[]}}(ee,b,V);J=ie.domain,Q=ie.categories}var re=function resolveXDomain(e,t,i){if(!i)return t;if("category"!==e)return[i[0],i[1]];var r=t.indexOf(i[0]),n=t.indexOf(i[1]);return r>=0&&n>=r?t.slice(r,n+1):t}(ee,J,f.xDomain);!function applyStacking(e){var t,i={},r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(n.option.stack){var a="".concat(n.axisIndex,"::").concat(n.option.stack);(i[a]=i[a]||[]).push(n)}else{var o,s=_createForOfIteratorHelper(n.points);try{for(s.s();!(o=s.n()).done;){var l=o.value;l.base=0,l.top=null===l.y?0:l.y}}catch(e){s.e(e)}finally{s.f()}}}}catch(e){r.e(e)}finally{r.f()}for(var h in i){var u,c={},d=_createForOfIteratorHelper(i[h]);try{for(d.s();!(u=d.n()).done;){var f,p=_createForOfIteratorHelper(u.value.points);try{for(p.s();!(f=p.n()).done;){var v=f.value,m=String(v.xValue),g=c[m]||0,b=null===v.y?0:v.y;v.base=g,v.top=g+b,c[m]=v.top}}catch(e){p.e(e)}finally{p.f()}}}catch(e){d.e(e)}finally{d.f()}}}(b),function applyWaterfall(e){var t,i=_createForOfIteratorHelper(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;if("waterfall"===r.type){var n,a=0,o=_createForOfIteratorHelper(r.points);try{for(o.s();!(n=o.n()).done;){var s=n.value,l=s.raw,h=!(!l||"object"!==_typeof(l)||Array.isArray(l)||!l.total),u=s.y||0;h?(s.base=0,s.top=a):(s.base=a,s.top=a+u,a+=u)}}catch(e){o.e(e)}finally{o.f()}}}}catch(e){i.e(e)}finally{i.f()}}(b);var ne={option:V,type:ee,domain:re,scale:null,index:0,position:"left"},ae=b.some(function(e){return"heatmap"===e.type}),oe=j.map(function(e,t){if(Z&&0===t)return{option:e,type:"category",domain:e.__categories||[],scale:null,index:t,position:e.position||"left"};if(ae&&(void 0===e.type||"category"===e.type)){for(var i={},r=[],n=0,a=b;n<a.length;n++){var o=a[n];if("heatmap"===o.type){var s,l=_createForOfIteratorHelper(o.points);try{for(l.s();!(s=l.n()).done;){var h=s.value,u=String(void 0===h.name?h.xValue:h.name);i[u]||(i[u]=!0,r.push(void 0===h.name?h.xValue:h.name))}}catch(e){l.e(e)}finally{l.f()}}}return{option:e,type:"category",domain:r,scale:null,index:t,position:e.position||(0===t?"left":"right")}}var c=e.type||"linear",d=f.yDomains?f.yDomains[t]:0===t?f.yDomain:null;return{option:e,type:c,domain:d||buildYDomain(b,t,e,c),scale:null,index:t,position:e.position||(0===t?"left":"right")}}),se=oe[0];return function applyEqualAspect(e,t,i,r){if("equal"!==e.aspect||"cartesian"!==t)return;if("category"===i.type)return;var n=r[0];if(!n||"category"===n.type)return;var a=Number(i.domain[0]),o=Number(i.domain[1]),s=Number(n.domain[0]),l=Number(n.domain[1]);if(![a,o,s,l].every(function(e){return isFinite(e)}))return;var h=Math.abs(o-a),u=Math.abs(l-s),c=Math.max(h,u);if(!(c>0))return;if(h<c){var d=(a+o)/2;i.domain=[d-c/2,d+c/2]}if(u<c){var f=(s+l)/2;n.domain=[f-c/2,f+c/2]}}(e,N,ne,oe),{labels:_objectSpread2({chart:"图表",sector:"扇区",value:"数值",ratio:"占比",indicator:"指标",coordinate:"坐标",liquid:"水位",slice:"切片"},e.labels||{}),kind:N,orientation:Z?"horizontal":"vertical",radar:m,sankey:D,funnel:H,gauge:R,liquid:E,treemap:L,graph:z,radarDomains:W,option:v,theme:p,series:b,xAxis:ne,yAxes:oe,yAxis:se,categories:Q,visibleSeries:b.filter(function(e){return!e.hidden}),hiddenIds:C,hiddenSlices:B}}function buildPoints(e,t,i,r,n){var a=Array.isArray(e.data)?e.data:[],o=[],s=!1;if("function"===e.type||"parametric"===e.type)return function buildCurvePoints(e,t){var i=[],r=e.params||{},n="function"===e.type,a=void 0===e.polarExpression||null===e.polarExpression?"":String(e.polarExpression).trim(),o=!n&&""!==a,s=n?String(e.expression||""):o?a:String(e.xExpression||""),l=n||o?"":String(e.yExpression||""),h=null,u=null;try{h=compileExpression(s),n||o||(u=compileExpression(l))}catch(e){h=null,u=null}var c=n?[-10,10]:[0,2*Math.PI],d=Array.isArray(e.domain)&&e.domain.length>=2?e.domain:null,f=d?Number(d[0]):c[0],p=d?Number(d[1]):c[1];if(n&&t&&Array.isArray(t.xDomain)&&t.xDomain.length>=2){var v=Number(t.xDomain[0]),m=Number(t.xDomain[1]);isFinite(v)&&isFinite(m)&&m>v&&(f=v,p=m)}isFinite(f)&&isFinite(p)&&p!==f||(f=c[0],p=c[1]);for(var g=Number(e.samples),b=Math.max(24,Math.min(6e3,isFinite(g)&&g>0?Math.round(g):n?240:360)),k=_objectSpread2({},r),S=n?"x":"t",w=0;w<b;w++){var A=f+(p-f)*w/(b-1);k[S]=A;var _=A,M=NaN,C=NaN;h&&(n?M=h.evaluate(k):o?(_=(C=h.evaluate(k))*Math.cos(A),M=C*Math.sin(A)):u&&(_=h.evaluate(k),M=u.evaluate(k)));var T=isFinite(_)&&isFinite(M);i.push({index:w,xValue:A,y:T?M:null,raw:n?{x:A,y:M}:o?{t:A,x:_,y:M,r:C}:{t:A,x:_,y:M},base:0,top:T?M:0,name:n?s:o?"r = ".concat(s):"(".concat(s,", ").concat(l,")")})}return{points:i,hasExplicitX:!0}}(e,n);if("graph"===e.type&&r){for(var l=Array.isArray(r.nodes)?r.nodes:[],h=Array.isArray(r.links)?r.links:[],u=function indexOf(e){return"number"==typeof e?e:l.findIndex(function(t){return t.id===e||t.name===e})},c=0;c<l.length;c++){var d=l[c],f=toNumber(d.value);o.push({index:c,xValue:d.name,y:f,raw:d,base:0,top:null===f?0:f,name:d.name})}for(var p=0;p<h.length;p++){var v=h[p],m=u(v.source),g=u(v.target),b="".concat(m>=0?l[m].name:String(v.source)," → ").concat(g>=0?l[g].name:String(v.target)),k=toNumber(v.value);o.push({index:l.length+p,xValue:b,y:null===k?1:k,raw:{__graphLink:!0,source:v.source,target:v.target,value:v.value},base:0,top:null===k?1:k,name:b})}return{points:o,hasExplicitX:!0}}if("sankey"===e.type&&i){var S,w=Array.isArray(i.nodes)?i.nodes:[],A=Array.isArray(i.links)?i.links:[],_=new Array(w.length).fill(0),M=new Array(w.length).fill(0),C=function _indexOf(e){return"number"==typeof e?e:w.findIndex(function(t){return t.name===e})},T=_createForOfIteratorHelper(A);try{for(T.s();!(S=T.n()).done;){var P=S.value,I=C(P.source),O=C(P.target),N=Number(P.value)||0;I>=0&&(M[I]+=N),O>=0&&(_[O]+=N)}}catch(e){T.e(e)}finally{T.f()}for(var D=_.map(function(e,t){return Math.max(e,M[t])}),H=0;H<w.length;H++){var R=w[H];o.push({index:H,xValue:R.name,y:D[H],raw:R,base:0,top:D[H],name:R.name})}for(var E=0;E<A.length;E++){var L=A[E],z=C(L.source),B=C(L.target),W="".concat(z>=0?w[z].name:String(L.source)," → ").concat(B>=0?w[B].name:String(L.target));o.push({index:w.length+E,xValue:W,y:Number(L.value)||0,raw:{__sankeyLink:!0,source:L.source,target:L.target,value:L.value},base:0,top:Number(L.value)||0,name:W})}return{points:o,hasExplicitX:!0}}if("radar"===e.type&&t&&Array.isArray(t.indicators)){for(var V=0;V<t.indicators.length;V++){var j=t.indicators[V],U=a[V],X=U&&"object"===_typeof(U)&&!Array.isArray(U)&&void 0!==U.value?toNumber(U.value):toNumber(U);o.push({index:V,xValue:j.name,y:X,raw:U,base:0,top:null===X?0:X,name:j.name})}return{points:o,hasExplicitX:!0}}if("candlestick"===e.type){for(var K=0;K<a.length;K++){var G=a[K],Y=Array.isArray(G)?G:G&&"object"===_typeof(G)&&Array.isArray(G.value)?G.value:null;if(!Y||Y.length<4)o.push({index:K,xValue:K,y:null,raw:G,base:0,top:0});else{var q=toNumber(Y[0]),$=toNumber(Y[1]),Z=toNumber(Y[2]),J=toNumber(Y[3]),Q=G&&"object"===_typeof(G)&&!Array.isArray(G)&&void 0!==G.name?String(G.name):void 0;s=!0,o.push({index:K,xValue:void 0===Q?K:Q,y:$,raw:G,base:0,top:null===$?0:$,name:Q,ohlc:[null===q?0:q,null===$?0:$,null===Z?0:Z,null===J?0:J]})}}return{points:o,hasExplicitX:s}}if("heatmap"===e.type){for(var ee=0;ee<a.length;ee++){var te=a[ee];if(!Array.isArray(te)||te.length<3)o.push({index:ee,xValue:ee,y:null,raw:te,base:0,top:0});else{var ie=toNumber(te[2]);s=!0,o.push({index:ee,xValue:te[0],y:ie,raw:te,base:0,top:null===ie?0:ie,name:String(te[1])})}}return{points:o,hasExplicitX:s}}if("boxplot"===e.type){for(var re=0;re<a.length;re++){var ne=a[re],ae=Array.isArray(ne)?ne.map(function(e){return Number(e)}):null;if(ae&&ae.length){var oe=5===ae.length?[ae[0],ae[1],ae[2],ae[3],ae[4]]:computeBoxplotSummary(ae);s=!0,o.push({index:re,xValue:re,y:oe[2],raw:ne,base:0,top:oe[2],boxplot:oe})}else o.push({index:re,xValue:re,y:null,raw:ne,base:0,top:0})}return{points:o,hasExplicitX:s}}if("waterfall"===e.type){for(var se=0;se<a.length;se++){var le=a[se],he=null,ue=void 0;if("number"==typeof le)he=toNumber(le);else if(le&&"object"===_typeof(le)&&!Array.isArray(le)){var ce=le;he=toNumber(void 0===ce.value?ce.y:ce.value),void 0!==ce.name&&(ue=String(ce.name))}else he=toNumber(le);s=!0,o.push({index:se,xValue:void 0===ue?se:ue,y:he,raw:le,base:0,top:null===he?0:he,name:ue})}return{points:o,hasExplicitX:s}}if("treemap"===e.type){var de=[],fe=function visit(e,t){var i,r=_createForOfIteratorHelper(e.slice().sort(function(e,t){return treemapNodeValue(t)-treemapNodeValue(e)}));try{for(r.s();!(i=r.n()).done;){var n=i.value;de.push({node:n,depth:t}),Array.isArray(n&&n.children)&&n.children.length&&fe(n.children,t+1)}}catch(e){r.e(e)}finally{r.f()}};Array.isArray(e.data)&&fe(e.data,0);for(var pe=0;pe<de.length;pe++){var ve=de[pe].node,ye=treemapNodeValue(ve);o.push({index:pe,xValue:ve&&void 0!==ve.name?ve.name:pe,y:ye,raw:ve,base:0,top:ye,name:ve&&void 0!==ve.name?String(ve.name):String(pe)})}return{points:o,hasExplicitX:!0}}for(var me=0;me<a.length;me++){var xe=a[me],ge=me,be=null,ke=void 0,Se=!1;if(Array.isArray(xe)){if(ge=xe[0],be=toNumber(xe[1]),xe.length>2){var we=toNumber(xe[2]);ke=null===we?void 0:we}Se=!0}else if("number"==typeof xe||null===xe)be=toNumber(xe);else if(xe&&"object"===_typeof(xe)){var Ae=e.xField||"x",_e=e.yField||"y";if(void 0!==xe[Ae]?(ge=xe[Ae],Se=!0):void 0!==xe.x?(ge=xe.x,Se=!0):void 0!==xe.name&&"bar"===e.type&&(ge=xe.name,Se=!0),void 0!==xe[_e]?be=toNumber(xe[_e]):void 0!==xe.y?be=toNumber(xe.y):void 0!==xe.value&&(be=toNumber(xe.value)),void 0!==xe.size){var Me=toNumber(xe.size);ke=null===Me?void 0:Me}}Se&&(s=!0);var Ce=void 0;xe&&"object"===_typeof(xe)&&!Array.isArray(xe)&&void 0!==xe.name?Ce=String(xe.name):"pie"===e.type&&Array.isArray(xe)&&"string"==typeof xe[0]&&(Ce=xe[0]),o.push({index:me,xValue:ge,y:be,raw:xe,base:0,top:null===be?0:be,name:Ce,size:ke})}return{points:o,hasExplicitX:s}}function toNumber(e){if(function isNil(e){return null==e||"number"==typeof e&&isNaN(e)}(e))return null;var t=Number(e);return isFinite(t)?t:null}function applyCurveDomain(e,t,i){if("function"===t.type||"parametric"===t.type){var r,n=[],a=[],o=_createForOfIteratorHelper(e.points);try{for(o.s();!(r=o.n()).done;){var s=r.value.raw;s&&"object"===_typeof(s)&&("number"==typeof s.x&&a.push(s.x),"number"==typeof s.y&&n.push(s.y))}}catch(e){o.e(e)}finally{o.f()}var l=n.filter(function(e){return isFinite(e)});if(l.length&&(e.domainValues=robustRange(l)),"parametric"===t.type){var h=a.filter(function(e){return isFinite(e)});h.length&&(e.domainXValues=[Math.min.apply(Math,_toConsumableArray(h)),Math.max.apply(Math,_toConsumableArray(h))])}var u=t.params||{},c=[];if("function"===t.type)c=diagnoseExpression(String(t.expression||""),{variable:"x",params:u,values:n});else if(void 0!==t.polarExpression&&null!==t.polarExpression&&""!==String(t.polarExpression).trim()){var d,f=[],p=_createForOfIteratorHelper(e.points);try{for(p.s();!(d=p.n()).done;){var v=d.value.raw;v&&"object"===_typeof(v)&&"number"==typeof v.r&&f.push(v.r)}}catch(e){p.e(e)}finally{p.f()}c=diagnoseExpression(String(t.polarExpression),{variable:"t",params:u,values:f}).map(function(e){return _objectSpread2(_objectSpread2({},e),{},{message:"r(θ):".concat(e.message)})})}else{var m=String(t.xExpression||""),g=String(t.yExpression||""),b=expressionVariables(m),k=expressionVariables(g),S=function withPrefix(e,t){return e.map(function(e){return _objectSpread2(_objectSpread2({},e),{},{message:"".concat(t,":").concat(e.message)})})};c=[].concat(_toConsumableArray(S(diagnoseExpression(m,{variable:"t",params:u,values:a,additionalVariables:k}),"x(t)")),_toConsumableArray(S(diagnoseExpression(g,{variable:"t",params:u,values:n,additionalVariables:b}),"y(t)")))}if(c.length){e.expressionDiagnostics=c;var w=c.find(function(e){return"error"===e.severity});w&&(e.expressionError=w.message)}}}function expressionVariables(e){try{return compileExpression(e).variables}catch(e){return[]}}function buildYDomain(e,t,i,r){var n,a=[],o=!1,s=_createForOfIteratorHelper(e);try{for(s.s();!(n=s.n()).done;){var l=n.value;if(!l.hidden&&l.axisIndex===t)if("bar"!==l.type&&"area"!==l.type||(o=!0),l.domainValues&&l.domainValues.length){var h=_slicedToArray(robustRange(l.domainValues),2),u=h[0],c=h[1];a.push(u,c)}else{var d,f=_createForOfIteratorHelper(l.points);try{for(f.s();!(d=f.n()).done;){var p=d.value;null!==p.y&&a.push(p.y),p.ohlc&&a.push(p.ohlc[2],p.ohlc[3]),p.boxplot&&a.push(p.boxplot[0],p.boxplot[4]),l.option.stack&&(a.push(p.base),a.push(p.top)),"waterfall"===l.type&&a.push(p.base,p.top)}}catch(e){f.e(e)}finally{f.f()}}}}catch(e){s.e(e)}finally{s.f()}var v=_slicedToArray(extent(a),2),m=v[0],g=v[1];o&&(m=Math.min(m,0),g=Math.max(g,0));var b=isFiniteNumber(i.min),k=isFiniteNumber(i.max);if(b&&(m=i.min),k&&(g=i.max),!1!==i.nice&&"log"!==r){var S=_slicedToArray(niceDomain([m,g],i.tickCount||5),2);m=S[0],g=S[1]}if("log"!==r){var w=o&&!b&&Math.abs(m)<1e-12,A=o&&!k&&Math.abs(g)<1e-12,_=_slicedToArray(padDomain(m,g,i,b||w,k||A),2);m=_[0],g=_[1]}if("log"===r){var M=a.filter(function(e){return e>0});M.length?(m=Math.min.apply(Math,_toConsumableArray(M)),g=Math.max.apply(Math,_toConsumableArray(M))):(m=1,g=10),isFiniteNumber(i.min)&&i.min>0&&(m=i.min),isFiniteNumber(i.max)&&i.max>0&&(g=i.max)}return[round(m,10),round(g,10)]}function treemapNodeValue(e){if(!e)return 0;if(Array.isArray(e.children)&&e.children.length)return e.children.reduce(function(e,t){return e+treemapNodeValue(t)},0);var t=Number(e.value);return isFinite(t)&&t>0?t:0}function computeBoxplotSummary(e){var t=e.filter(function(e){return isFinite(e)}).sort(function(e,t){return e-t});if(!t.length)return[0,0,0,0,0];var i=function quantile(e){var i=(t.length-1)*e,r=Math.floor(i),n=Math.ceil(i);return r===n?t[r]:t[r]+(t[n]-t[r])*(i-r)};return[t[0],i(.25),i(.5),i(.75),t[t.length-1]]}function toSerializableOption(e){if(null==e)return e;if(Array.isArray(e))return e.map(toSerializableOption);if("function"!=typeof e){if("object"===_typeof(e)){var t={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var r=toSerializableOption(e[i]);void 0!==r&&(t[i]=r)}return t}return e}}function chartThemeToEnginePatch(e){var t=Array.isArray(e.colorPalette)&&e.colorPalette.length?e.colorPalette:["#0D6EFD"],i=function pick(e,i){return t[e]||t[0]||i};return{primary:i(0,"#0D6EFD"),success:i(1,"#198754"),warning:i(2,"#FFC107"),danger:i(3,"#DC3545"),info:i(4,"#0DCAF0"),text:e.textColor,muted:e.subTextColor,hint:e.axisLabelColor,border:e.axisLineColor,background:e.backgroundColor,palette:t,chrome:{selection:{stroke:e.selection.stroke},handle:{fill:i(0,"#0D6EFD")},linkHook:{fill:i(1,"#198754")},slot:{fill:i(1,"#198754"),hoverFill:i(2,"#FFC107")},guide:{color:i(0,"#0D6EFD")},linkLabel:{background:e.tooltip.background,fill:e.tooltip.textColor},textSelection:{color:e.brush.fill},shadow:{sm:e.tooltip.shadowColor,md:e.tooltip.shadowColor,lg:e.tooltip.shadowColor}},base:{fontFamily:{base:e.fontFamily},fontSize:{md:e.fontSize}}}}function applyChartThemeToEngine(e,t){if(!e||"function"!=typeof e.setTheme)throw new Error("applyChartThemeToEngine(ice, theme) 需要一个 ICE 实例");return e.setTheme(chartThemeToEnginePatch(t)),e}function formatNumberTick(e,t){if(!isFinite(e))return String(e);var i=Math.abs(e);if(0!==i&&(i>=1e9||i<1e-4))return e.toExponential(1);var r=0;t>0&&t<1?r=Math.min(6,Math.ceil(-Math.log10(t))):Number.isInteger(e)||(r=2);var n=e.toFixed(r),a=_slicedToArray((r>0?n.replace(/\.?0+$/,""):n).split("."),2),o=a[0],s=a[1],l=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");return s?"".concat(l,".").concat(s):l}function formatTick(e,t,i,r){if("function"==typeof r){var n=r(e,i);return null==n?"":String(n)}return"time"===t.type?t.format(e,i):"linear"===t.type||"log"===t.type?formatNumberTick(Number(e),function tickStep(e){for(var t=e.ticks(5),i=1/0,r=1;r<t.length;r++){var n=Math.abs(Number(t[r])-Number(t[r-1]));n>0&&n<i&&(i=n)}return isFinite(i)?i:0}(t)):String(e)}var C=function(){function LinearScale(e,t){_classCallCheck(this,LinearScale),_defineProperty(this,"type","linear"),this.domain=function normalize(e){var t=Number(e[0]),i=Number(e[1]);if(t===i){var r=Math.abs(t)>1?.1*Math.abs(t):1;return[t-r,i+r]}return[t,i]}(e),this.range=t}return _createClass(LinearScale,[{key:"map",value:function map(e){var t=Number(e);if(!isFinite(t))return NaN;var i=_slicedToArray(this.domain,2),r=i[0],n=i[1],a=_slicedToArray(this.range,2),o=a[0];return o+(t-r)/(n-r)*(a[1]-o)}},{key:"invert",value:function invert(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=_slicedToArray(this.range,2),a=n[0],o=n[1];return o===a?i:i+(e-a)/(o-a)*(r-i)}},{key:"ticks",value:function ticks(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=niceStep(r-i,e),a=[],o=Math.ceil(i/n)*n;o<=r+1e-6*n&&a.length<1e3;o+=n)a.push(round(o));return a}},{key:"bandwidth",value:function bandwidth(){return 0}},{key:"bandStart",value:function bandStart(e){return this.map(e)}},{key:"step",value:function step(){var e=this.ticks(5);return e.length>1?Math.abs(e[1]-e[0]):0}},{key:"isBand",value:function isBand(){return!1}},{key:"indexAt",value:function indexAt(e){return-1}},{key:"fractionOf",value:function fractionOf(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1];return r===i?0:(Number(e)-i)/(r-i)}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=_slicedToArray(this.domain,2),i=t[0];return i+e*(t[1]-i)}},{key:"span",value:function span(){return this.domain[1]-this.domain[0]}},{key:"format",value:function format(e,t){for(var i=this.ticks(5),r=1/0,n=1;n<i.length;n++){var a=Math.abs(i[n]-i[n-1]);a>0&&a<r&&(r=a)}return formatNumberTick(Number(e),isFinite(r)?r:0)}},{key:"clone",value:function clone(){return new LinearScale([this.domain[0],this.domain[1]],[this.range[0],this.range[1]])}}])}();var T=function(){function BandScale(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,BandScale),_defineProperty(this,"type","category"),this.domain=e.length?e.slice():[""],this.range=t,this.paddingInner=void 0===i.paddingInner?.2:i.paddingInner,this.paddingOuter=void 0===i.paddingOuter?.1:i.paddingOuter,this._step=this.computeStep()}return _createClass(BandScale,[{key:"computeStep",value:function computeStep(){var e=Math.max(1,this.domain.length),t=_slicedToArray(this.range,2),i=t[0],r=t[1],n=Math.abs(r-i),a=e-this.paddingInner+2*this.paddingOuter;return n/Math.max(1e-4,a)}},{key:"indexOf",value:function indexOf(e){var t=this.domain.indexOf(e);if(-1===t)for(var i=0;i<this.domain.length;i++)if(String(this.domain[i])===String(e))return i;return t}},{key:"map",value:function map(e){return this.bandStart(e)+this.bandwidth()/2}},{key:"bandStart",value:function bandStart(e,t){var i=void 0!==t&&t>=0?t:this.indexOf(e);return i<0?NaN:_slicedToArray(this.range,1)[0]+(this.range[1]>=this.range[0]?1:-1)*(this.paddingOuter*this._step+i*this._step)}},{key:"bandwidth",value:function bandwidth(){return this._step*(1-this.paddingInner)}},{key:"step",value:function step(){return this._step}},{key:"isBand",value:function isBand(){return!0}},{key:"ticks",value:function ticks(){return this.domain.slice()}},{key:"indexAt",value:function indexAt(e){for(var t=this.bandwidth(),i=this.range[1]>=this.range[0]?1:-1,r=0;r<this.domain.length;r++){var n=this.bandStart(void 0,r),a=n+i*t,o=Math.min(n,a),s=Math.max(n,a);if(e>=o&&e<=s)return r}return-1}},{key:"invert",value:function invert(e){var t=this.indexAt(e);if(t>=0)return this.domain[t];for(var i=0,r=1/0,n=0;n<this.domain.length;n++){var a=Math.abs(this.map(this.domain[n])-e);a<r&&(r=a,i=n)}return this.domain[i]}},{key:"nearestIndex",value:function nearestIndex(e){var t=this.indexAt(e);if(t>=0)return t;for(var i=0,r=1/0,n=0;n<this.domain.length;n++){var a=Math.abs(this.map(this.domain[n])-e);a<r&&(r=a,i=n)}return i}},{key:"fractionOf",value:function fractionOf(e){var t=this.indexOf(e);return t<0?0:this.domain.length<=1?.5:(t+.5)/this.domain.length}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=this.domain.length;if(t){var i=Math.max(0,Math.min(t-1,Math.round(e*t-.5)));return this.domain[i]}}},{key:"span",value:function span(){return this.domain.length}},{key:"format",value:function format(e){return null==e?"":String(e)}},{key:"clone",value:function clone(){return new BandScale(this.domain.slice(),[this.range[0],this.range[1]],{paddingInner:this.paddingInner,paddingOuter:this.paddingOuter})}}])}(),P=function(){function LogScale(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,LogScale),_defineProperty(this,"type","log"),this.base=i.logBase&&i.logBase>1?i.logBase:10;var r=Math.max(Number.MIN_VALUE,Number(e[0])),n=Math.max(1.0001*r,Number(e[1]));this.domain=[r,n],this.range=t}return _createClass(LogScale,[{key:"log",value:function log(e){return Math.log(e)/Math.log(this.base)}},{key:"map",value:function map(e){var t=Number(e);if(!(t>0))return NaN;var i=_slicedToArray(this.domain,2),r=i[0],n=i[1],a=_slicedToArray(this.range,2),o=a[0],s=a[1],l=this.log(r),h=this.log(n);return o+(this.log(t)-l)/(h-l)*(s-o)}},{key:"invert",value:function invert(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=_slicedToArray(this.range,2),a=n[0],o=n[1];if(o===a)return i;var s=this.log(i),l=s+(e-a)/(o-a)*(this.log(r)-s);return Math.pow(this.base,l)}},{key:"ticks",value:function ticks(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=[],a=Math.floor(this.log(i)),o=Math.ceil(this.log(r)),s=o-a;if(s<=2*e)for(var l=a;l<=o;l++){var h=Math.pow(this.base,l);h>=.999999*i&&h<=1.000001*r&&n.push(h)}else for(var u=Math.max(1,Math.ceil(s/e)),c=a;c<=o;c+=u){var d=Math.pow(this.base,c);d>=.999999*i&&d<=1.000001*r&&n.push(d)}return n.length||n.push(i,r),n}},{key:"bandwidth",value:function bandwidth(){return 0}},{key:"bandStart",value:function bandStart(e){return this.map(e)}},{key:"step",value:function step(){var e=this.ticks(5);return e.length>1?Math.abs(e[1]-e[0]):0}},{key:"isBand",value:function isBand(){return!1}},{key:"indexAt",value:function indexAt(e){return-1}},{key:"fractionOf",value:function fractionOf(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=this.log(i),a=this.log(r);return a===n?0:(this.log(Math.max(Number.MIN_VALUE,Number(e)))-n)/(a-n)}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=this.log(i),a=this.log(r);return Math.pow(this.base,n+e*(a-n))}},{key:"span",value:function span(){return this.domain[1]-this.domain[0]}},{key:"format",value:function format(e,t){return formatNumberTick(Number(e),this.step())}},{key:"clone",value:function clone(){return new LogScale([this.domain[0],this.domain[1]],[this.range[0],this.range[1]],{logBase:this.base})}}])}();function createScale(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};switch(e){case"category":return new T(t,i,r);case"time":return new v(t,i,r);case"log":return new P(t,i,r);default:return new C(t,i)}}function measureTextWidth(e,t,i,r){if(!t)return 0;if(e&&"function"==typeof e.measureText)try{var n=e.font;e.font="".concat(i,"px ").concat(r);var a=e.measureText(t);if(e.font=n,a&&"number"==typeof a.width&&isFinite(a.width))return a.width}catch(e){}for(var o=0,s=0;s<t.length;s++){o+=t.charCodeAt(s)>11904?1:.55}return o*i}function computeLayout(e,t,i){for(var r=e.option.margin,n=createScale(e.xAxis.type,e.xAxis.domain,[0,Math.max(1,i.width)],{logBase:e.xAxis.option.logBase}),a=buildAxisLayout(e,"x",e.xAxis,n,t),o=e.yAxes.map(function(r){var n=createScale(r.type,r.domain,[Math.max(1,i.height),0],{logBase:r.option.logBase});return buildAxisLayout(e,"y",r,n,t)}),s=0,l=0,h=0;h<e.yAxes.length;h++){var u=e.yAxes[h],c=o[h];if(!1!==u.option.show&&"cartesian"===e.kind){var d=yAxisReserve(u,c);"right"===u.position?(c.offset=l,l+=d):(c.offset=s,s+=d)}else c.offset=0}var f=o[0],p=function buildTitleLayout(e){var t=e.option.title;if(!t||!t.text&&!t.subtext)return null;var i=e.theme,r={color:t.textStyle&&t.textStyle.color||i.textColor,fontSize:t.textStyle&&t.textStyle.fontSize||i.fontSize+4,fontWeight:t.textStyle&&t.textStyle.fontWeight||"bold"},n={color:t.subtextStyle&&t.subtextStyle.color||i.subTextColor,fontSize:t.subtextStyle&&t.subtextStyle.fontSize||i.fontSize},a="left"===t.left?"left":"right"===t.left?"right":"center";return{text:t.text||"",subtext:t.subtext||"",x:0,y:0,align:a,textStyle:r,subtextStyle:n}}(e),v=p?(p.text?1.5*p.textStyle.fontSize:0)+(p.subtext?1.4*p.subtextStyle.fontSize:0):0,m=function layoutLegend(e,t,i,r){var n=e.option.legend;if(!n||!1===n.show)return null;var a=[];if("polar"===e.kind||"funnel"===e.kind){var o,s=_createForOfIteratorHelper(e.series);try{for(s.s();!(o=s.n()).done;){var l=o.value;if("pie"===l.type||"funnel"===l.type){var h,u=_createForOfIteratorHelper(l.points);try{for(u.s();!(h=u.n()).done;){var c=h.value;a.push({seriesId:l.id,seriesIndex:l.index,dataIndex:c.index,name:c.name||"".concat(l.name," ").concat(c.index+1),color:c.color||l.color,hidden:!!e.hiddenSlices["".concat(l.id,"#").concat(c.index)],x:0,y:0,width:0,height:0})}}catch(e){u.e(e)}finally{u.f()}}}}catch(e){s.e(e)}finally{s.f()}}else{var d,f=_createForOfIteratorHelper(e.series);try{for(f.s();!(d=f.n()).done;){var p=d.value;a.push({seriesId:p.id,seriesIndex:p.index,name:p.name,color:p.color,hidden:!!p.hidden,x:0,y:0,width:0,height:0})}}catch(e){f.e(e)}finally{f.f()}}if(!a.length)return null;var v={position:n.position||"top",items:a},m=e.theme.fontSize,g=n.itemWidth||12,b=Math.max(n.itemHeight||12,1.4*m),k=n.itemGap||16,S=a.map(function(i){return{item:i,textWidth:measureTextWidth(t,i.name,m,e.theme.fontFamily)}}),w=b+4,A=e.option.margin;if("left"===v.position||"right"===v.position){for(var _=Math.max.apply(Math,_toConsumableArray(S.map(function(e){return e.textWidth})).concat([0])),M=S.length*w,C="left"===v.position?A.left:i.width-A.right-(g+6+_),T=Math.max(0,i.height-r-A.bottom),P=Math.max(r,r+(T-M)/2),I=0;I<S.length;I++){var O=S[I].item;O.x=C,O.y=P+I*w,O.width=g+6+S[I].textWidth,O.height=w}return v}var N,D=[],H=[],R=0,E=Math.max(40,i.width-A.left-A.right),L=_createForOfIteratorHelper(S);try{for(L.s();!(N=L.n()).done;){var z=N.value,B=g+6+z.textWidth;H.length&&R+k+B>E&&(D.push(H),H=[],R=0),R+=(H.length>1?k:0)+B,H.push(z)}}catch(e){L.e(e)}finally{L.f()}H.length&&D.push(H);for(var W="top"===v.position?r:i.height-A.bottom-D.length*w,V=0,j=D;V<j.length;V++){var U,X=j[V],K=X.reduce(function(e,t,i){return e+g+6+t.textWidth+(i>0?k:0)},0),G=(i.width-K)/2,Y=_createForOfIteratorHelper(X);try{for(Y.s();!(U=Y.n()).done;){var q=U.value;q.item.x=G,q.item.y=W,q.item.width=g+6+q.textWidth,q.item.height=w,G+=q.item.width+k}}catch(e){Y.e(e)}finally{Y.f()}W+=w}return v}(e,t,i,r.top+v),g=m?function legendSizeOf(e,t){var i=t.option.legend,r=t.theme.fontSize,n=i.itemWidth||12,a=Math.max(i.itemHeight||12,1.4*r)+4;if("left"===e.position||"right"===e.position){var o=e.items.map(function(e){return e.x}),s=e.items.map(function(e){return e.x+e.width}),l=o.length?Math.min.apply(Math,_toConsumableArray(o)):0,h=s.length?Math.max.apply(Math,_toConsumableArray(s)):0;return{width:Math.max(n+6,h-l),height:e.items.length*a}}var u,c=1,d=e.items.length?e.items[0].y:0,f=_createForOfIteratorHelper(e.items);try{for(f.s();!(u=f.n()).done;){var p=u.value;p.y>d&&(c+=1,d=p.y)}}catch(e){f.e(e)}finally{f.f()}return{width:0,height:c*a}}(m,e):{width:0,height:0},b=r.left,k=r.top,S=i.width-r.right,w=i.height-r.bottom;k+=v,m&&("top"===m.position?k+=g.height+8:"bottom"===m.position?w-=g.height+8:"left"===m.position?b+=g.width+8:S-=g.width+8),b+=s,S-=l,"cartesian"===e.kind&&!1!==e.xAxis.option.show&&(w-=a.labelHeight+4+6,e.xAxis.option.name&&(w-=a.nameHeight+6));var A=e.option.dataZoom&&e.option.dataZoom.slider,_=!("cartesian"!==e.kind||!e.option.dataZoom||A&&!1===A.show),M=Math.max(12,Number(A&&A.height)||26),C=null;if(_){var T=i.height-r.bottom,P=M+14;w+P>T&&(w-=w+P-T),C=w+14}var I={x:Math.round(Math.max(0,b)),y:Math.round(Math.max(0,k)),width:Math.max(1,Math.round(S-b)),height:Math.max(1,Math.round(w-k))},O=null;if("polar"===e.kind||"radar"===e.kind||"gauge"===e.kind||"liquid"===e.kind){var N,D=Math.min(I.width,I.height)/2,H=I.width/2,R=I.height/2,E="polar"===e.kind&&e.series.some(function(e){return"pie"===e.type&&!(e.option.label&&!1===e.option.label.show)})?Math.min(46,.26*D):6;N="gauge"===e.kind?Math.max(10,.94*Math.min(H-14,R-4)):"liquid"===e.kind?Math.max(10,Math.min(H,R)-3):Math.max(10,D*function polarRadiusRatio(e){if("radar"===e.kind){var t=Number(e.radar&&e.radar.radius);return isFinite(t)&&t>0?Math.max(.1,Math.min(1,t)):.72}var i,r=_createForOfIteratorHelper(e.series);try{for(r.s();!(i=r.n()).done;){var n=i.value;if("pie"===n.type){var a=Number(n.option.radius);if(isFinite(a)&&a>0)return Math.max(.1,Math.min(1,a))}}}catch(e){r.e(e)}finally{r.f()}return.92}(e)-E);var L=I.x+I.width/2,z=I.y+I.height/2;O={cx:L,cy:z,radius:N},I={x:Math.round(L-N),y:Math.round(z-N),width:Math.round(2*N),height:Math.round(2*N)}}if("cartesian"===e.kind&&"equal"===e.option.aspect){var B=Math.min(I.width,I.height);I={x:Math.round(I.x+(I.width-B)/2),y:Math.round(I.y+(I.height-B)/2),width:Math.round(B),height:Math.round(B)}}p&&(p.y=r.top);var W=_&&null!==C?{x:I.x,y:Math.round(C),width:I.width,height:Math.round(M)}:null;return{canvas:i,plot:I,titleRect:p?{x:p.x,y:p.y,width:0,height:v}:null,legendRect:m?legendBoundingRect(m):null,legend:m,title:p,polar:O,slider:W,xAxisLayout:a,yAxes:o,yAxisLayout:f,margin:r}}function yAxisReserve(e,t){var i=t.labelWidth+4+6;return e.option.name&&(i+=t.nameHeight+6),i}function buildAxisLayout(e,t,i,r,n){var a=i.option,o=e.theme.fontSize,s=e.theme.fontFamily;if(!1===a.show)return{ticks:[],labels:[],offset:0,labelWidth:0,labelHeight:0,nameWidth:0,nameHeight:0};for(var l=r.ticks(a.tickCount||5),h=[],u=0,c=0;c<l.length;c++){var d=formatTick(l[c],r,c,a.formatter);h.push(d);var f=measureTextWidth(n,d,o,s);f>u&&(u=f)}if("x"===t&&l.length>2&&u>0){var p="function"==typeof r.range?r.range():r.range,v=p&&p.length>=2?Math.abs(p[1]-p[0]):0;if(v>0){var m=v/(l.length-1||1),g=Math.max(u+10,64);if(m<g)for(var b=Math.ceil(g/m),k=0;k<h.length;k++)k%b!==0&&(h[k]="")}}var S=Math.abs(Number(a.labelRotate)||0),w=S*Math.PI/180,A=u*Math.sin(w)+1.4*o,_=a.name||"",M=_?measureTextWidth(n,_,o,s):0;return{ticks:l,labels:h,offset:0,labelWidth:"y"===t?u:0,labelHeight:"x"===t?S>0?A:1.4*o:0,nameWidth:"x"===t?M:0,nameHeight:_?1.4*o:0}}function legendBoundingRect(e){if(!e.items.length)return{x:0,y:0,width:0,height:0};var t,i=1/0,r=1/0,n=-1/0,a=-1/0,o=_createForOfIteratorHelper(e.items);try{for(o.s();!(t=o.n()).done;){var s=t.value;i=Math.min(i,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x+s.width),a=Math.max(a,s.y+s.height)}}catch(e){o.e(e)}finally{o.f()}return{x:i,y:r,width:n-i,height:a-r}}var I=function(){function ChartComponent(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ChartComponent),_defineProperty(e=_callSuper(this,ChartComponent,[_objectSpread2({origin:"top-left",fill:!1,stroke:!1,draggable:!1,transformable:!1,linkable:!1,interactive:!1},t)]),"loopRegistered",!1),e}return _inherits(ChartComponent,e.ICEComponent),_createClass(ChartComponent,[{key:"keyboardEvtHandler",value:function keyboardEvtHandler(){}},{key:"containsLocalPoint",value:function containsLocalPoint(e,t){return e>=0&&t>=0&&e<=this.state.width&&t<=this.state.height}},{key:"unit",value:function unit(){var e=this.ice;return e?1/((e.viewport&&e.viewport.scale||1)*(e.dpr||1)):1}},{key:"snap",value:function snap(e){var t=this.ice;if(!t)return e;var i=(t.viewport&&t.viewport.scale||1)*(t.dpr||1);return Math.round(e*i)/i+.5/i}},{key:"markDirty",value:function markDirty(){return this.dirty=!0,this.ice&&(this.ice.dirty=!0),this}},{key:"keepAnimating",value:function keepAnimating(){if(!this.loopRegistered){this.loopRegistered=!0;var e=_objectSpread2(_objectSpread2({},this.props.animations||{}),{},{__tick:{from:0,to:1,duration:100,loop:!0}});this.props.animations=e,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}}},{key:"stopAnimating",value:function stopAnimating(){if(this.loopRegistered){this.loopRegistered=!1;var e=_objectSpread2({},this.props.animations||{});for(var t in e)e[t]&&(e[t].finished=!0);delete e.__tick,this.props.animations=e,this.ice&&this.ice.animationManager&&this.ice.animationManager.remove(this)}}},{key:"setFont",value:function setFont(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal";this.ctx.font="".concat(i," ").concat(e,"px ").concat(t)}}])}(),O="auto";function shouldAnimate(){return"instant"!==O&&("full"===O||!function prefersReducedMotion(){if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return!!window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(e){return!1}}())}var N=function(){function Axis(e){var t;return _classCallCheck(this,Axis),_defineProperty(t=_callSuper(this,Axis,[_objectSpread2({interactive:!1},e)]),"axisIndex",0),_defineProperty(t,"position","left"),_defineProperty(t,"axis",null),_defineProperty(t,"layout",null),_defineProperty(t,"theme",null),_defineProperty(t,"lastTicks",[]),_defineProperty(t,"morphFrom",[]),t.orientation=e.orientation,t.axisIndex=e.axisIndex||0,t.position=e.position||"left",t}return _inherits(Axis,I),_createClass(Axis,[{key:"edgeX",value:function edgeX(e){var t=this.layout.plot,i=e.offset||0;return"left"===this.position?t.x-i:t.x+t.width+i}},{key:"axisLayoutOf",value:function axisLayoutOf(e){return"x"===this.orientation?e.xAxisLayout:e.yAxes[this.axisIndex]||e.yAxisLayout}},{key:"tickEntries",value:function tickEntries(){var e=this.axis,t=this.layout;if(!e||!t||!e.scale)return null;var i=e.option||{},r=e.scale,n=t.plot,a=this.axisLayoutOf(t),o=a.ticks,s=this.theme?this.theme.fontSize:12,l=this.theme?this.theme.fontFamily:"sans-serif",h=1;if("x"===this.orientation&&o.length>1){var u,c=0,d=_createForOfIteratorHelper(a.labels);try{for(d.s();!(u=d.n()).done;){var f=u.value,p=measureTextWidth(this.ctx,f,s,l);p>c&&(c=p)}}catch(e){d.e(e)}finally{d.f()}var v=n.width/o.length,m=Math.max(c+8,64);m>v&&(h=Math.ceil(m/Math.max(1,v)))}for(var g=[],b=0;b<o.length;b++){var k=r.map(o[b]),S="x"===this.orientation?n.x+k:n.y+k;if(isFinite(S)){var w=formatTick(o[b],r,b,i.formatter)||"",A=b===o.length-1,_=!(!w||h>1&&b%h!==0&&!A);g.push({key:String(o[b]),pos:S,label:w,drawn:_})}}return g}},{key:"morphProgress",value:function morphProgress(){var e=Number(this.state.axisMorph);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"renderedPositions",value:function renderedPositions(){var e,t=this,i=this.morphProgress(),r=new Map,n=_createForOfIteratorHelper(this.lastTicks);try{var a=function _loop(){var n=e.value,a=t.morphFrom.find(function(e){return e.key===n.key});r.set(n.key,a?a.pos+(n.pos-a.pos)*i:n.pos)};for(n.s();!(e=n.n()).done;)a()}catch(e){n.e(e)}finally{n.f()}return r}},{key:"syncTicks",value:function syncTicks(){var e=this,t=this.tickEntries();if(t&&!(t.length===this.lastTicks.length&&t.every(function(t,i){return t.key===e.lastTicks[i].key&&Math.abs(t.pos-e.lastTicks[i].pos)<.01}))){var i=0===this.lastTicks.length,r=this.renderedPositions();if(this.morphFrom=this.lastTicks.map(function(e){var t;return _objectSpread2(_objectSpread2({},e),{},{pos:null!==(t=r.get(e.key))&&void 0!==t?t:e.pos})}),this.lastTicks=t,this.setState({axisMorph:0}),i||!shouldAnimate())return this.setState({axisMorph:1}),void this.markDirty();var n=_objectSpread2({},this.props.animations||{});n.axisMorph={from:0,to:1,duration:240,easing:"easeOutCubic",startTime:void 0,finished:!1},this.props.animations=n,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}}},{key:"renderedTickPos",value:function renderedTickPos(e){var t=String(e),i=this.morphFrom.find(function(e){return e.key===t}),r=this.lastTicks.find(function(e){return e.key===t});return i&&r?i.pos+(r.pos-i.pos)*this.morphProgress():r?r.pos:i?i.pos:null}},{key:"morphing",value:function morphing(){return this.morphProgress()<1}},{key:"drawTick",value:function drawTick(e,t,i,r,n){if(!1!==n.showTick){var a=this.ctx;if(a.beginPath(),"x"===this.orientation)a.moveTo(e,t.y+t.height),a.lineTo(e,t.y+t.height+4*r);else{var o="left"===this.position?-1:1;a.moveTo(i,e),a.lineTo(i+4*o*r,e)}a.stroke()}}},{key:"drawTickLabel",value:function drawTickLabel(e,t,i,r,n,a){if(t){var o=this.ctx;if("x"!==this.orientation){var s="left"===this.position?-1:1;o.fillText(t,r+s*n,e)}else{var l=i.y+i.height+n;a.labelRotate?(o.save(),o.translate(e,l),o.rotate(Number(a.labelRotate)*Math.PI/180),o.textAlign="right",o.textBaseline="middle",o.fillText(t,0,0),o.restore()):o.fillText(t,e,l)}}}},{key:"doRender",value:function doRender(){if(this.axis&&this.layout&&this.theme){var e=this.axis.option;if(!1!==e.show)if(this.axis.scale){var t=this.layout.plot,i="x"===this.orientation?this.layout.xAxisLayout:this.layout.yAxes[this.axisIndex]||this.layout.yAxisLayout,r=this.ctx,n=this.theme.fontSize,a=this.unit(),o=10*a;r.beginPath(),r.save(),r.lineWidth=a,r.strokeStyle=this.theme.axisLineColor,r.fillStyle=this.theme.axisLabelColor,this.setFont(n,this.theme.fontFamily),r.textBaseline="x"===this.orientation?"top":"middle",r.textAlign="x"===this.orientation?"center":"left"===this.position?"right":"left";var s="x"===this.orientation?t.x:this.edgeX(i);if(!1!==e.showAxisLine){if(r.beginPath(),"x"===this.orientation){var l=this.snap(t.y+t.height);r.moveTo(t.x,l),r.lineTo(t.x+t.width,l)}else{var h=this.snap(s);r.moveTo(h,t.y),r.lineTo(h,t.y+t.height)}r.stroke()}var u,c="left"===this.position?-1:1,d=this.tickEntries()||[],f=this.morphProgress(),p=new Map,v=_createForOfIteratorHelper(this.morphFrom);try{for(v.s();!(u=v.n()).done;){var m=u.value;p.set(m.key,m.pos)}}catch(e){v.e(e)}finally{v.f()}var g=new Set(d.map(function(e){return e.key}));if(f<1){r.fillStyle=this.theme.axisLabelColor,r.globalAlpha=(1-f)*(1-f);var b,k=_createForOfIteratorHelper(this.morphFrom);try{for(k.s();!(b=k.n()).done;){var S=b.value;!g.has(S.key)&&S.drawn&&(this.drawTick(S.pos,t,s,a,e),this.drawTickLabel(S.pos,S.label,t,s,o,e))}}catch(e){k.e(e)}finally{k.f()}r.globalAlpha=1}var w,A=_createForOfIteratorHelper(d);try{for(A.s();!(w=A.n()).done;){var _=w.value,M=p.get(_.key),C=void 0===M?_.pos:M+(_.pos-M)*f;r.globalAlpha=void 0===M?Math.min(1,.15+.85*f):1,this.drawTick(C,t,s,a,e),_.drawn&&this.drawTickLabel(C,_.label,t,s,o,e)}}catch(e){A.e(e)}finally{A.f()}if(r.globalAlpha=1,e.name)if(this.setFont(n,this.theme.fontFamily),r.fillStyle=this.theme.subTextColor,"x"===this.orientation)if(r.textAlign="center",r.textBaseline="middle",this.layout.slider)r.textAlign="right",r.textBaseline="bottom",r.fillText(e.name,t.x+t.width,t.y+t.height-4*a);else{var T=t.y+t.height+o+i.labelHeight+6*a+.5*n;r.fillText(e.name,t.x+t.width/2,T)}else{var P=s+c*(i.labelWidth+o+i.nameHeight+4*a);r.save(),r.translate("left"===this.position?Math.max(.6*n,P):P,t.y+t.height/2),r.rotate(-Math.PI/2),r.textAlign="center",r.textBaseline="middle",r.fillText(e.name,0,0),r.restore()}r.restore()}}}}])}(),D=function(){function GridLines(e){var t;return _classCallCheck(this,GridLines),_defineProperty(t=_callSuper(this,GridLines,[_objectSpread2({interactive:!1},e)]),"xScale",null),_defineProperty(t,"yScale",null),_defineProperty(t,"horizontal",[]),_defineProperty(t,"plot",{x:0,y:0,width:0,height:0}),_defineProperty(t,"grid",{}),_defineProperty(t,"theme",null),_defineProperty(t,"axisX",null),_defineProperty(t,"axisYList",[]),t}return _inherits(GridLines,I),_createClass(GridLines,[{key:"syncTicks",value:function syncTicks(){if([this.axisX].concat(_toConsumableArray(this.axisYList)).filter(Boolean).some(function(e){return"function"==typeof e.morphing&&e.morphing()})){var e=_objectSpread2({},this.props.animations||{});e.axisMorph={from:0,to:1,duration:240,easing:"easeOutCubic",startTime:void 0,finished:!1},this.props.animations=e,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}}},{key:"yTickPos",value:function yTickPos(e,t,i){var r=void 0===e?null:this.axisYList[e];if(!r||"function"!=typeof r.renderedTickPos)return i;var n=r.renderedTickPos(t);return null==n?i:n}},{key:"xTickPos",value:function xTickPos(e,t){var i=this.axisX;if(!i||"function"!=typeof i.renderedTickPos)return t;var r=i.renderedTickPos(e);return null==r?t:r}},{key:"doRender",value:function doRender(){var e=this;if(this.theme&&this.xScale&&this.yScale&&!1!==this.grid.show){var t=this.plot,i=this.ctx;i.beginPath(),i.save(),i.strokeStyle=this.grid.color||this.theme.splitLineColor,i.lineWidth=(this.grid.lineWidth||1)*this.unit(),"function"==typeof i.setLineDash&&i.setLineDash((this.grid.lineDash||[]).map(function(t){return t*e.unit()}));var r=this.horizontal.length?this.horizontal:this.yScale?[{scale:this.yScale,ticks:this.yScale.ticks(5)}]:[];if(!1!==this.grid.y){i.beginPath();var n,a=_createForOfIteratorHelper(r);try{for(a.s();!(n=a.n()).done;){var o,s=n.value,l=_createForOfIteratorHelper(s.ticks);try{for(l.s();!(o=l.n()).done;){var h=o.value,u=t.y+s.scale.map(h);if(isFinite(u)){var c=this.snap(this.yTickPos(s.index,h,u));i.moveTo(t.x,c),i.lineTo(t.x+t.width,c)}}}catch(e){l.e(e)}finally{l.f()}}}catch(e){a.e(e)}finally{a.f()}i.stroke()}if(this.grid.x){i.beginPath();var d,f=_createForOfIteratorHelper(this.xScale.ticks(5));try{for(f.s();!(d=f.n()).done;){var p=d.value,v=t.x+this.xScale.map(p);if(isFinite(v)){var m=this.snap(this.xTickPos(p,v));i.moveTo(m,t.y),i.lineTo(m,t.y+t.height)}}}catch(e){f.e(e)}finally{f.f()}i.stroke()}i.restore()}}}])}(),H=[6,4];function resolveAxisValue(e,t,i,r){if(null==t||""===t)return{ok:!1,code:"annotation:invalid-value",message:"".concat(r," 标注缺少定位值。")};var n=e.scale;if(!n||"function"!=typeof n.map)return{ok:!1,code:"annotation:unsupported-scene",message:"当前场景没有可用于定位的坐标系。"};var a,o=n.domain||[],s=t;if("category"===e.type){var l=o.indexOf(s);if(l<0&&(l=o.findIndex(function(e){return String(e)===String(s)})),l<0){var h=Number(s);if(!(Number.isInteger(h)&&h>=0&&h<o.length))return{ok:!1,code:"annotation:unknown-category",message:"".concat(r," 轴没有类目「").concat(String(t),"」。")};l=h}s=o[l];var u=Number(n.map(s));return isFinite(u)?{ok:!0,pixel:i+u,inside:!0,label:String(s)}:{ok:!1,code:"annotation:unknown-category",message:"".concat(r," 轴定位不到「").concat(String(t),"」。")}}if("time"===e.type){if(a=toTimestamp(s),!isFinite(a))return{ok:!1,code:"annotation:invalid-value",message:"".concat(r," 标注的「").concat(String(t),"」不是合法时间。")}}else if(a=Number(s),!isFinite(a))return{ok:!1,code:"annotation:invalid-value",message:"".concat(r," 标注的「").concat(String(t),"」不是合法数值。")};var c=Number(n.map(a));if(!isFinite(c))return{ok:!1,code:"annotation:out-of-range",message:"".concat(r," 标注的「").concat(String(t),"」无法定位。")};var d=function domainRange(e){if(!e||!e.length)return[null,null];var t=e.map(function(e){return Number(e)});if(t.length&&t.every(function(e){return isFinite(e)}))return[Math.min.apply(Math,_toConsumableArray(t)),Math.max.apply(Math,_toConsumableArray(t))];return[0,e.length-1]}(o),f=_slicedToArray(d,2),p=f[0],v=f[1];return{ok:!0,pixel:i+c,inside:null===p||null===v||a>=p-1e-9&&a<=v+1e-9,label:String(t)}}function pickAxis(e,t,i){if("x"===t)return e.xAxis;var r=Number.isInteger(i)&&Number(i)>=0?Number(i):0;return e.yAxes[r]||e.yAxes[0]||e.xAxis}function positiveNumber(e,t){var i=Number(e);return isFinite(i)&&i>0?i:t}function textPosition(e,t){return"start"===e||"center"===e||"end"===e?e:t}function pointTextPosition(e){return"bottom"===e||"left"===e||"right"===e||"top"===e?e:"top"}function resolvedLineDash(e){return Array.isArray(e.lineDash)?e.lineDash.filter(function(e){return isFinite(Number(e))&&Number(e)>=0}).map(Number):!1===e.dashed?[]:H}function symbolOf(e){return"rect"===e||"diamond"===e||"triangle"===e?e:"circle"}function clamp$1(e,t,i){return Math.max(t,Math.min(i,e))}function plainText(e){return null==e?"":String(e)}function withAlpha(e,t){if("string"!=typeof e)return"rgba(0,0,0,".concat(t,")");if("#"===e.charAt(0)){var i=e.slice(1);if(3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),6!==i.length)return e;var r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return"rgba(".concat(r,",").concat(n,",").concat(a,",").concat(t,")")}return 0===e.indexOf("rgb(")?e.replace("rgb(","rgba(").replace(")",",".concat(t,")")):e}function resolveAnnotation(e,t){var i={lines:[],points:[],areas:[]},r=[];if(!e||"object"!==_typeof(e))return{resolved:i,diagnostics:r};var n=Array.isArray(e.lines)?e.lines:[],a=Array.isArray(e.points)?e.points:[],o=Array.isArray(e.areas)?e.areas:[];if(!(n.length+a.length+o.length))return{resolved:i,diagnostics:r};if("cartesian"!==t.kind)return r.push({code:"annotation:unsupported-scene",severity:"warning",message:"标注需要直角坐标系(x / y 轴),当前场景没有,已跳过全部标注。",kind:"line",index:0}),{resolved:i,diagnostics:r};for(var s=t.theme,l=s.textColor,h=s.fontSize||12,u=0;u<o.length;u++){var c=o[u]||{},d="x"===c.axis?"x":"y",f="x"===d?"x":"y",p=pickAxis(t,d,c.axisIndex),v="x"===d?t.plot.x:t.plot.y,m="x"===d?t.plot.width:t.plot.height,g=resolveAxisValue(p,c.from,v,f),b=resolveAxisValue(p,c.to,v,f);if(g.ok&&b.ok){var k=v,S=v+m,w=clamp$1(g.pixel,k,S),A=clamp$1(b.pixel,k,S);Math.abs(A-w)<=0?r.push({code:"annotation:out-of-range",severity:"warning",message:"标注区间#".concat(u,":区间「").concat(plainText(c.from)," ~ ").concat(plainText(c.to),"」不在当前可视范围内,已跳过。"),kind:"area",index:u}):i.areas.push({kind:"area",index:u,axis:d,axisIndex:Number.isInteger(c.axisIndex)?Number(c.axisIndex):0,from:w,to:A,color:"string"==typeof c.color&&c.color?c.color:withAlpha(l,.1),text:plainText(c.text),textPosition:textPosition(c.textPosition,"center"),textColor:"string"==typeof c.textColor&&c.textColor?c.textColor:l,fontSize:positiveNumber(c.fontSize,h)})}else pushDiagnostic(r,g.ok?b:g,"area",u)}for(var _=0;_<n.length;_++){var M=n[_]||{},C="x"===M.axis?"x":"y",T="x"===C?"x":"y",P=pickAxis(t,C,M.axisIndex),I="x"===C?t.plot.x:t.plot.y,O=resolveAxisValue(P,M.value,I,T);if(O.ok)if(O.inside){var N="string"==typeof M.color&&M.color?M.color:l;i.lines.push({kind:"line",index:_,axis:C,axisIndex:Number.isInteger(M.axisIndex)?Number(M.axisIndex):0,pixel:O.pixel,text:plainText(M.text),color:N,lineWidth:positiveNumber(M.lineWidth,1),lineDash:resolvedLineDash(M),textPosition:textPosition(M.textPosition,"end"),textColor:"string"==typeof M.textColor&&M.textColor?M.textColor:N,fontSize:positiveNumber(M.fontSize,h)})}else pushDiagnostic(r,{ok:!1,code:"annotation:out-of-range",message:"".concat(T," 标注的「").concat(O.label,"」不在当前可视范围内,已跳过。")},"line",_);else pushDiagnostic(r,O,"line",_)}for(var D=0;D<a.length;D++){var H=a[D]||{},R=resolveAxisValue(t.xAxis,H.x,t.plot.x,"x"),E=resolveAxisValue(pickAxis(t,"y",H.axisIndex),H.y,t.plot.y,"y");if(R.ok&&E.ok&&R.inside&&E.inside){var L="string"==typeof H.color&&H.color?H.color:l;i.points.push({kind:"point",index:D,axisIndex:Number.isInteger(H.axisIndex)?Number(H.axisIndex):0,x:R.pixel,y:E.pixel,text:plainText(H.text),color:L,symbol:symbolOf(H.symbol),symbolSize:positiveNumber(H.symbolSize,8),textPosition:pointTextPosition(H.textPosition),textColor:"string"==typeof H.textColor&&H.textColor?H.textColor:L,fontSize:positiveNumber(H.fontSize,h)})}else{pushDiagnostic(r,R.ok?E.ok?R.inside?{ok:!1,code:"annotation:out-of-range",message:"y 标注的「".concat(E.label,"」不在当前可视范围内,已跳过。")}:{ok:!1,code:"annotation:out-of-range",message:"x 标注的「".concat(R.label,"」不在当前可视范围内,已跳过。")}:E:R,"point",D)}}return{resolved:i,diagnostics:r}}function pushDiagnostic(e,t,i,r){var n="line"===i?"标注线":"point"===i?"标注点":"标注区间";e.push({code:t.code,severity:"annotation:invalid-value"===t.code?"error":"warning",message:"".concat(n,"#").concat(r,":").concat(t.message),kind:i,index:r})}var R=function(){function Annotation(e){var t;return _classCallCheck(this,Annotation),_defineProperty(t=_callSuper(this,Annotation,[_objectSpread2({interactive:!1},e)]),"resolved",{lines:[],points:[],areas:[]}),_defineProperty(t,"diagnostics",[]),_defineProperty(t,"ink",[]),_defineProperty(t,"theme",null),_defineProperty(t,"option",null),_defineProperty(t,"__boxScratch",[0,0,0,0]),_defineProperty(t,"plot",{x:0,y:0,width:0,height:0}),_defineProperty(t,"xAxis",null),_defineProperty(t,"yAxes",[]),t}return _inherits(Annotation,I),_createClass(Annotation,[{key:"sync",value:function sync(e,t){this.option=e||null,this.theme=t.theme;var i=resolveAnnotation(e,t),r=i.resolved,n=i.diagnostics;this.resolved=r,this.diagnostics=n,this.markDirty()}},{key:"hasInk",get:function get(){return this.resolved.lines.length>0||this.resolved.points.length>0||this.resolved.areas.length>0}},{key:"__localBox",value:function __localBox(){var e=this.__boxScratch;return e[0]=0,e[1]=0,e[2]=this.state.width||0,e[3]=this.state.height||0,e}},{key:"doRender",value:function doRender(){if(this.theme&&this.hasInk){var e=this.plot,t=[];this.drawAreas(t,e),this.drawLines(t,e),this.drawPoints(t),this.ink=t}else this.ink=[]}},{key:"drawAreas",value:function drawAreas(e,t){var i,r=this,n=_createForOfIteratorHelper(this.resolved.areas);try{var a=function _loop(){var n=i.value,a=r.ctx;a.beginPath();var o=Math.min(n.from,n.to),s=Math.max(n.from,n.to),l="x"===n.axis?o:t.x,h="y"===n.axis?o:t.y,u="x"===n.axis?s-o:t.width,c="y"===n.axis?s-o:t.height;if(u<=0||c<=0)return 1;a.save(),a.fillStyle=n.color,a.fillRect(l,h,u,c),a.restore();var d=null;if(n.text){a.save(),r.setFont(n.fontSize,r.theme.fontFamily,"normal"),a.fillStyle=n.textColor;if("y"===n.axis){var f="start"===n.textPosition?"left":"end"===n.textPosition?"right":"center",p="start"===n.textPosition?t.x+6:"end"===n.textPosition?t.x+t.width-6:t.x+t.width/2;a.textAlign=f,a.textBaseline="middle";var v=(n.from+n.to)/2;r.strokeHalo(function(){return a.strokeText(n.text,p,v)}),a.fillText(n.text,p,v),d={kind:"area",index:n.index,x:"right"===f?p-r.textWidth(n.text,n.fontSize):"center"===f?p-r.textWidth(n.text,n.fontSize)/2:p,y:v-n.fontSize/2,width:r.textWidth(n.text,n.fontSize),height:n.fontSize,text:n.text}}else{var m=(n.from+n.to)/2;a.textAlign="center",a.textBaseline="top";var g=t.y+6;r.strokeHalo(function(){return a.strokeText(n.text,m,g)}),a.fillText(n.text,m,g),d={kind:"area",index:n.index,x:m-r.textWidth(n.text,n.fontSize)/2,y:g,width:r.textWidth(n.text,n.fontSize),height:n.fontSize,text:n.text}}a.restore()}e.push({kind:"area",index:n.index,x:l,y:h,width:u,height:c,text:n.text}),d&&e.push(d)};for(n.s();!(i=n.n()).done;)a()}catch(e){n.e(e)}finally{n.f()}}},{key:"drawLines",value:function drawLines(e,t){var i,r=this,n=_createForOfIteratorHelper(this.resolved.lines);try{for(n.s();!(i=n.n()).done;){var a=i.value,o=this.ctx,s="y"===a.axis,l=this.snap(a.pixel);o.save(),o.beginPath(),o.strokeStyle=a.color,o.lineWidth=a.lineWidth*this.unit(),"function"==typeof o.setLineDash&&o.setLineDash(a.lineDash.map(function(e){return e*r.unit()})),s?(o.moveTo(t.x,l),o.lineTo(t.x+t.width,l)):(o.moveTo(l,t.y),o.lineTo(l,t.y+t.height)),o.stroke(),o.restore();var h=s?{kind:"line",index:a.index,x:t.x,y:a.pixel-1,width:t.width,height:2,text:a.text}:{kind:"line",index:a.index,x:a.pixel-1,y:t.y,width:2,height:t.height,text:a.text};e.push(h),a.text&&e.push(this.drawLineText(a,t,s))}}catch(e){n.e(e)}finally{n.f()}}},{key:"drawLineText",value:function drawLineText(e,t,i){var r=this.ctx;r.save(),this.setFont(e.fontSize,this.theme.fontFamily,"normal"),r.fillStyle=e.textColor;var n,a=this.textWidth(e.text,e.fontSize);if(i){var o="start"===e.textPosition?"left":"end"===e.textPosition?"right":"center",s="start"===e.textPosition?t.x+6:"end"===e.textPosition?t.x+t.width-6:t.x+t.width/2,l=e.pixel-e.fontSize-4<t.y,h=l?e.pixel+4:e.pixel-4;r.textAlign=o,r.textBaseline=l?"top":"bottom",this.strokeHalo(function(){return r.strokeText(e.text,s,h)}),r.fillText(e.text,s,h);var u="right"===o?s-a:"center"===o?s-a/2:s;n={kind:"line",index:e.index,x:u,y:l?h:h-e.fontSize,width:a,height:e.fontSize,text:e.text}}else{var c=e.pixel+4+a>t.x+t.width,d=c?e.pixel-4:e.pixel+4,f=t.y+6;r.textAlign=c?"right":"left",r.textBaseline="top",this.strokeHalo(function(){return r.strokeText(e.text,d,f)}),r.fillText(e.text,d,f),n={kind:"line",index:e.index,x:c?d-a:d,y:f,width:a,height:e.fontSize,text:e.text}}return r.restore(),n}},{key:"drawPoints",value:function drawPoints(e){var t,i=_createForOfIteratorHelper(this.resolved.points);try{for(i.s();!(t=i.n()).done;){var r=t.value,n=this.ctx,a=r.symbolSize/2;n.save(),n.beginPath(),n.fillStyle=r.color,"circle"===r.symbol?n.arc(r.x,r.y,a,0,2*Math.PI):"rect"===r.symbol?n.rect(r.x-a,r.y-a,r.symbolSize,r.symbolSize):"diamond"===r.symbol?(n.moveTo(r.x,r.y-a),n.lineTo(r.x+a,r.y),n.lineTo(r.x,r.y+a),n.lineTo(r.x-a,r.y),n.closePath()):(n.moveTo(r.x,r.y-a),n.lineTo(r.x+a,r.y+a),n.lineTo(r.x-a,r.y+a),n.closePath()),n.fill(),n.restore(),e.push({kind:"point",index:r.index,x:r.x-a,y:r.y-a,width:r.symbolSize,height:r.symbolSize,text:r.text}),r.text&&e.push(this.drawPointText(r))}}catch(e){i.e(e)}finally{i.f()}}},{key:"drawPointText",value:function drawPointText(e){var t=this.ctx,i=e.symbolSize/2;t.save(),this.setFont(e.fontSize,this.theme.fontFamily,"normal"),t.fillStyle=e.textColor;var r=this.textWidth(e.text,e.fontSize),n=e.x,a=e.y,o="center",s="bottom";"top"===e.textPosition?(o="center",s="bottom",a=e.y-i-3):"bottom"===e.textPosition?(o="center",s="top",a=e.y+i+3):"left"===e.textPosition?(o="right",s="middle",n=e.x-i-3):(o="left",s="middle",n=e.x+i+3),t.textAlign=o,t.textBaseline=s,this.strokeHalo(function(){return t.strokeText(e.text,n,a)}),t.fillText(e.text,n,a),t.restore();var l="right"===o?n-r:"center"===o?n-r/2:n,h=e.fontSize,u="bottom"===s?a-h:"middle"===s?a-h/2:a;return{kind:"point",index:e.index,x:l,y:u,width:r,height:h,text:e.text}}},{key:"strokeHalo",value:function strokeHalo(e){var t=this.ctx,i=this.theme?this.theme.labelHaloColor:null;if(i){var r=t.lineWidth,n=t.lineJoin,a=t.strokeStyle;t.lineWidth=3*this.unit(),t.lineJoin="round",t.strokeStyle=i,e(),t.lineWidth=r,t.lineJoin=n,t.strokeStyle=a}}},{key:"textWidth",value:function textWidth(e,t){return measureTextWidth(this.ctx,e,t,this.theme?this.theme.fontFamily:"sans-serif")}}])}(),E=function(){function PlotArea(e){var t;return _classCallCheck(this,PlotArea),_defineProperty(t=_callSuper(this,PlotArea,[_objectSpread2({interactive:!0},e)]),"background",null),_defineProperty(t,"borderColor",null),t}return _inherits(PlotArea,I),_createClass(PlotArea,[{key:"setBackground",value:function setBackground(e){return this.background=e,this.markDirty()}},{key:"doRender",value:function doRender(){this.ctx.beginPath();var e=this.state,t=e.width,i=e.height;if(this.background&&(this.ctx.fillStyle=this.background,this.ctx.fillRect(0,0,t,i)),this.borderColor){this.ctx.strokeStyle=this.borderColor,this.ctx.lineWidth=this.unit();var r=this.unit()/2;this.ctx.strokeRect(r,r,t-this.unit(),i-this.unit())}}}])}(),L=function(){function Legend(e){var t;return _classCallCheck(this,Legend),_defineProperty(t=_callSuper(this,Legend,[_objectSpread2({interactive:!0},e)]),"layout",null),_defineProperty(t,"theme",null),_defineProperty(t,"selectable",!0),_defineProperty(t,"hoverIndex",-1),t}return _inherits(Legend,I),_createClass(Legend,[{key:"items",get:function get(){return this.layout&&this.layout.legend?this.layout.legend.items:[]}},{key:"hitItem",value:function hitItem(e,t){for(var i=this.items,r=0;r<i.length;r++){var n=i[r];if(e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)return r}return-1}},{key:"containsLocalPoint",value:function containsLocalPoint(e,t){return this.selectable&&this.hitItem(e,t)>=0}},{key:"doRender",value:function doRender(){if(this.theme&&this.layout&&this.layout.legend){var e=this.ctx,t=this.layout.legend.items;this.layout.legend,e.beginPath(),e.save();for(var i=0;i<t.length;i++){var r=t[i],n=r.y+r.height/2;e.globalAlpha=r.hidden?.45:1,e.fillStyle=r.color,roundRect(e,r.x,n-6,12,12,Math.min(3,6)),e.fill(),this.setFont(this.theme.fontSize,this.theme.fontFamily),e.textAlign="left",e.textBaseline="middle",e.fillStyle=r.hidden?this.theme.legend.inactiveColor:this.theme.legend.textColor,e.fillText(r.name,r.x+12+6,n),this.hoverIndex===i&&(e.globalAlpha=1,e.strokeStyle=this.theme.axisLineColor,e.lineWidth=this.unit(),roundRect(e,r.x-4,r.y+1,r.width+8,r.height-2,4),e.stroke())}e.restore()}}}])}();function roundRect(e,t,i,r,n,a){var o=Math.max(0,Math.min(a,r/2,n/2));e.beginPath(),o<=0?e.rect(t,i,r,n):(e.moveTo(t+o,i),e.lineTo(t+r-o,i),e.arcTo(t+r,i,t+r,i+o,o),e.lineTo(t+r,i+n-o),e.arcTo(t+r,i+n,t+r-o,i+n,o),e.lineTo(t+o,i+n),e.arcTo(t,i+n,t,i+n-o,o),e.lineTo(t,i+o),e.arcTo(t,i,t+o,i,o),e.closePath())}var z=function(){function Title(e){var t;return _classCallCheck(this,Title),_defineProperty(t=_callSuper(this,Title,[_objectSpread2({interactive:!1},e)]),"layout",null),_defineProperty(t,"theme",null),t}return _inherits(Title,I),_createClass(Title,[{key:"doRender",value:function doRender(){var e=this.layout&&this.layout.title;if(e&&this.theme&&this.layout){var t=this.layout.canvas,i=this.ctx,r="left"===e.align?0:"right"===e.align?t.width:t.width/2,n=e.y;i.save(),i.textAlign=e.align,i.textBaseline="top",e.text&&(this.setFont(e.textStyle.fontSize,this.theme.fontFamily,e.textStyle.fontWeight),i.fillStyle=e.textStyle.color,i.fillText(e.text,r,n),n+=1.5*e.textStyle.fontSize),e.subtext&&(this.setFont(e.subtextStyle.fontSize,this.theme.fontFamily),i.fillStyle=e.subtextStyle.color,i.fillText(e.subtext,r,n)),i.restore()}}}])}(),B=function(){function Tooltip(e){var t;return _classCallCheck(this,Tooltip),_defineProperty(t=_callSuper(this,Tooltip,[_objectSpread2({interactive:!1},e)]),"theme",null),_defineProperty(t,"option",{}),_defineProperty(t,"layout",null),_defineProperty(t,"content",null),_defineProperty(t,"anchor",[0,0]),_defineProperty(t,"follow",!0),_defineProperty(t,"lastRect",null),_defineProperty(t,"pendingClear",!1),t}return _inherits(Tooltip,I),_createClass(Tooltip,[{key:"show",value:function show(e,t){var i=!this.content||this.pendingClear||this.currentOpacity()<.999;return this.content=e,this.anchor=t,this.pendingClear=!1,i&&this.playFade(!0),this.markDirty()}},{key:"hide",value:function hide(){return this.content?shouldAnimate()?(this.pendingClear=!0,this.playFade(!1),this.markDirty()):(this.content=null,this.lastRect=null,this.markDirty()):this}},{key:"panelOpacity",value:function panelOpacity(){var e=Number(this.state.panelOpacity);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"currentOpacity",value:function currentOpacity(){var e=Number(this.state.panelOpacity);return isFinite(e)?Math.max(0,Math.min(1,e)):0}},{key:"playFade",value:function playFade(e){if(!shouldAnimate())return this.setState({panelOpacity:e?1:0,slideY:0}),void(e||(this.content=null,this.lastRect=null));var t=_objectSpread2({},this.props.animations||{});t.panelOpacity={from:this.currentOpacity(),to:e?1:0,duration:e?140:110,easing:e?"easeOutCubic":"easeInQuad",startTime:void 0,finished:!1},e&&(t.slideY={from:6,to:0,duration:180,easing:"easeOutCubic",startTime:void 0,finished:!1},this.state.slideY=6),this.props.animations=t,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}},{key:"doRender",value:function doRender(){if(this.lastRect=null,this.content&&this.theme&&this.layout){var e=this.panelOpacity();if(this.pendingClear&&e<=.02)return this.content=null,void(this.pendingClear=!1);var t,i=this.theme,r=this.option,n=i.tooltip,a=r.fontSize||n.fontSize,o=i.fontFamily,s=n.padding,l=1.6*a,h=this.content.rows,u=this.content.title?measureTextWidth(this.ctx,this.content.title,a,o):0,c=0,d=_createForOfIteratorHelper(h);try{for(d.s();!(t=d.n()).done;){var f=t.value,p=16+measureTextWidth(this.ctx,f.name,a,o)+16+measureTextWidth(this.ctx,f.value,a,o);p>c&&(c=p)}}catch(e){d.e(e)}finally{d.f()}var v=Math.max(u,c)+2*s,m=2*s+(this.content.title?l:0)+h.length*l,g=r.offset||[14,14],b=this.layout.canvas,k=this.layout.plot,S=this.anchor[0]+g[0],w=this.anchor[1]+g[1];S+v>b.width&&(S=this.anchor[0]-g[0]-v),S=v<=k.width-4?Math.max(k.x+2,Math.min(S,k.x+k.width-v-2)):Math.max(2,Math.min(S,Math.max(2,b.width-v-2))),w+m>b.height&&(w=this.anchor[1]-g[1]-m);var A=k.y+k.height-(a+8)/2;if(w+m>A){var _=this.anchor[1]-g[1]-m;w=_>=k.y+2?_:Math.max(k.y+2,A-m)}w=Math.max(2,Math.min(w,Math.max(2,b.height-m-2))),this.lastRect={x:S,y:w,width:v,height:m};var M=this.ctx,C=this.unit();M.beginPath(),M.save(),M.globalAlpha=e,w+=Number(this.state.slideY)||0,M.shadowColor=n.shadowColor,M.shadowBlur=10*C,M.shadowOffsetY=2*C,M.fillStyle=r.backgroundColor||n.background,roundRect(M,S,w,v,m,n.radius),M.fill(),M.shadowColor="transparent",M.shadowBlur=0,M.shadowOffsetY=0,M.strokeStyle=r.borderColor||n.borderColor,M.lineWidth=C,roundRect(M,S+C/2,w+C/2,v-C,m-C,n.radius),M.stroke(),M.fillStyle=r.textColor||n.textColor,M.textAlign="left",M.textBaseline="middle";var T=w+s+l/2;this.content.title&&(this.setFont(a,o,"bold"),M.fillText(this.content.title,S+s,T),T+=l);var P,I=_createForOfIteratorHelper(h);try{for(I.s();!(P=I.n()).done;){var O=P.value,N=T+l/2-l/2+l/2;this.setFont(a,o),M.fillStyle=O.color,roundRect(M,S+s,N-4,8,8,2),M.fill(),M.fillStyle=r.textColor||n.textColor,M.fillText(O.name,S+s+8+8,N),M.textAlign="right",M.fillText(O.value,S+v-s,N),M.textAlign="left",T+=l}}catch(e){I.e(e)}finally{I.f()}M.restore()}}}])}();var W=function(){function Crosshair(e){var t;return _classCallCheck(this,Crosshair),_defineProperty(t=_callSuper(this,Crosshair,[_objectSpread2({interactive:!1},e)]),"layout",null),_defineProperty(t,"theme",null),_defineProperty(t,"option",{}),_defineProperty(t,"pixelX",null),_defineProperty(t,"pixelY",null),_defineProperty(t,"xLabel",""),_defineProperty(t,"yLabel",""),_defineProperty(t,"lastChipRects",[]),_defineProperty(t,"followDuration",90),t}return _inherits(Crosshair,I),_createClass(Crosshair,[{key:"show",value:function show(e,t,i,r){var n=null!==this.pixelX&&null!==e&&Math.abs(this.pixelX-e)<.5&&(this.pixelY===t||null!==this.pixelY&&null!==t&&Math.abs(this.pixelY-t)<.5);return this.pixelX=e,this.pixelY=t,this.xLabel=i,this.yLabel=r,n||this.animateAxis(e,t),this.markDirty()}},{key:"drawnX",value:function drawnX(){var e=Number(this.state.axisX);return null===this.pixelX?null:isFinite(e)?e:this.pixelX}},{key:"drawnY",value:function drawnY(){var e=Number(this.state.axisY);return null===this.pixelY?null:isFinite(e)?e:this.pixelY}},{key:"animateAxis",value:function animateAxis(e,t){if(!shouldAnimate()||null===e||this.followDuration<=0)this.setState({axisX:e,axisY:t});else{var i=this.drawnX(),r=this.drawnY();if(null!==i){var n=function crosshairGlideDuration(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;if(!isFinite(t)||t<=0)return 0;var r=Math.abs(e);return!isFinite(r)||r<=0?0:Math.max(16,Math.min(t,r/i))}(Math.abs(e-i),this.followDuration);if(n<=0)this.setState({axisX:e,axisY:t});else{var a=_objectSpread2({},this.props.animations||{});a.axisX={from:i,to:e,duration:n,easing:"easeOutCubic",startTime:void 0,finished:!1},null!==r&&null!==t&&(a.axisY={from:r,to:t,duration:n,easing:"easeOutCubic",startTime:void 0,finished:!1}),this.props.animations=a,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this)}}else this.setState({axisX:e,axisY:t})}}},{key:"hide",value:function hide(){return null===this.pixelX&&null===this.pixelY?this:(this.pixelX=null,this.pixelY=null,this.stopAxisAnimation(),this.markDirty())}},{key:"stopAxisAnimation",value:function stopAxisAnimation(){var e=this.props.animations;if(e)for(var t in e)e[t]&&(e[t].finished=!0);this.ice&&this.ice.animationManager&&this.ice.animationManager.remove(this),this.state.axisX=null,this.state.axisY=null}},{key:"doRender",value:function doRender(){if(this.lastChipRects=[],this.layout&&this.theme&&!1!==this.option.show&&"none"!==this.option.type&&(null!==this.pixelX||null!==this.pixelY)){var e=this.layout.plot,t=this.ctx,i=this.unit(),r=this.option.axis||"x";if(t.beginPath(),t.save(),t.strokeStyle=this.option.lineColor||this.theme.crosshair.lineColor,t.lineWidth=i,"function"==typeof t.setLineDash&&t.setLineDash([3*i,3*i]),t.beginPath(),null!==this.pixelX&&"y"!==r){var n=this.snap(this.drawnX());t.moveTo(n,e.y),t.lineTo(n,e.y+e.height)}if(null!==this.pixelY&&("y"===r||"xy"===r)){var a=this.snap(this.drawnY());t.moveTo(e.x,a),t.lineTo(e.x+e.width,a)}t.stroke(),"function"==typeof t.setLineDash&&t.setLineDash([]),!1!==this.option.showAxisLabel&&(this.setFont(this.theme.fontSize,this.theme.fontFamily),t.textAlign="center",t.textBaseline="middle",null!==this.pixelX&&this.xLabel&&"y"!==r&&this.drawChip(this.snap(this.drawnX()),e.y+e.height,this.xLabel),null===this.pixelY||!this.yLabel||"y"!==r&&"xy"!==r||this.drawChip(e.x,this.snap(this.drawnY()),this.yLabel)),t.restore()}}},{key:"drawChip",value:function drawChip(e,t,i){var r=this.ctx,n=this.theme,a=r.measureText(i).width+12,o=n.fontSize+6;r.fillStyle=n.crosshair.labelBackground,this.lastChipRects.push({x:e-a/2,y:t-o/2,width:a,height:o}),r.fillRect(e-a/2,t-o/2,a,o),r.fillStyle=n.crosshair.labelColor,r.fillText(i,e,t)}}])}(),V=function(){function Highlight(e){var t;return _classCallCheck(this,Highlight),_defineProperty(t=_callSuper(this,Highlight,[_objectSpread2({interactive:!1},e)]),"theme",null),_defineProperty(t,"hoverItems",[]),_defineProperty(t,"selectionItems",[]),t}return _inherits(Highlight,I),_createClass(Highlight,[{key:"setHover",value:function setHover(e){return this.hoverItems=e,this.markDirty()}},{key:"setSelection",value:function setSelection(e){return this.selectionItems=e,this.markDirty()}},{key:"doRender",value:function doRender(){if(this.theme){var e=this.ctx,t=this.unit();e.beginPath(),e.save();var i,r=_createForOfIteratorHelper(this.hoverItems);try{for(r.s();!(i=r.n()).done;){var n=i.value;if("rect"===n.shape){var a=n.width||0,o=n.height||0;if(a<=0||o<=0)continue;e.strokeStyle=n.color,e.lineWidth=Math.max(t,1.5*t),roundRect(e,n.x-a/2,n.y-o/2,a,o,Math.min(4,a/2,o/2)),e.stroke()}else{var s=Math.max(3,n.size/2+3);e.beginPath(),e.arc(n.x,n.y,s,0,2*Math.PI),e.fillStyle="rgba(255,255,255,0.55)",e.fill(),e.beginPath(),e.arc(n.x,n.y,s,0,2*Math.PI),e.strokeStyle=n.color,e.lineWidth=Math.max(t,1.5*t),e.stroke()}}}catch(e){r.e(e)}finally{r.f()}var l,h=_createForOfIteratorHelper(this.selectionItems);try{for(h.s();!(l=h.n()).done;){var u=l.value;if(e.strokeStyle=this.theme.selection.stroke,e.lineWidth=Math.max(t,1.5*t),"rect"===u.shape){var c=u.width||0,d=u.height||0;if(c<=0||d<=0)continue;roundRect(e,u.x-c/2-2,u.y-d/2-2,c+4,d+4,5),e.stroke()}else{var f=Math.max(3,u.size/2+3);e.beginPath(),e.arc(u.x,u.y,f,0,2*Math.PI),e.stroke()}}}catch(e){h.e(e)}finally{h.f()}e.restore()}}}])}(),j=function(){function Brush(e){var t;return _classCallCheck(this,Brush),_defineProperty(t=_callSuper(this,Brush,[_objectSpread2({interactive:!1},e)]),"theme",null),_defineProperty(t,"rect",null),_defineProperty(t,"color",null),t}return _inherits(Brush,I),_createClass(Brush,[{key:"setRect",value:function setRect(e){return this.rect=e,e?this.keepAnimating():this.stopAnimating(),this.markDirty()}},{key:"doRender",value:function doRender(){if(this.rect&&this.theme){var e=this.ctx,t=this.color||this.theme.brush,i=this.unit();if(e.beginPath(),e.save(),e.fillStyle=t.fill,e.fillRect(this.rect.x,this.rect.y,this.rect.width,this.rect.height),e.strokeStyle=t.stroke,e.lineWidth=i,"function"==typeof e.setLineDash){var r=[5*i,4*i],n=r[0]+r[1]||1;e.setLineDash(r),"number"==typeof e.lineDashOffset&&(e.lineDashOffset=-Date.now()/1e3*26%n)}e.strokeRect(this.rect.x,this.rect.y,this.rect.width,this.rect.height),"function"==typeof e.setLineDash&&e.setLineDash([]),e.restore()}}}])}(),U=function(){function RadarGrid(e){var t;return _classCallCheck(this,RadarGrid),_defineProperty(t=_callSuper(this,RadarGrid,[_objectSpread2({interactive:!1},e)]),"coord",null),_defineProperty(t,"theme",null),_defineProperty(t,"layout",null),t}return _inherits(RadarGrid,I),_createClass(RadarGrid,[{key:"doRender",value:function doRender(){var e=this.coord,t=this.theme;if(e&&t){var i=this.ctx,r=this.unit(),n=e.indicators.length;if(n){var a=e.polar.cx,o=e.polar.cy,s=e.polar.radius,l=function angleOf(e){return-Math.PI/2+e/n*Math.PI*2};this.layout,i.beginPath(),i.save(),i.lineWidth=r,i.strokeStyle=t.splitLineColor;for(var h=1;h<=e.splitNumber;h++){var u=s*h/e.splitNumber;if(i.beginPath(),"circle"===e.shape)i.arc(a,o,u,0,2*Math.PI);else{for(var c=0;c<n;c++){var d=l(c),f=a+Math.cos(d)*u,p=o+Math.sin(d)*u;0===c?i.moveTo(f,p):i.lineTo(f,p)}i.closePath()}i.stroke()}i.beginPath();for(var v=0;v<n;v++){var m=l(v);i.moveTo(a,o),i.lineTo(a+Math.cos(m)*s,o+Math.sin(m)*s)}i.stroke(),this.setFont(t.fontSize,t.fontFamily),i.fillStyle=t.subTextColor,i.textBaseline="middle";for(var g=0;g<n;g++){var b=l(g),k=a+Math.cos(b)*(s+10*r),S=o+Math.sin(b)*(s+10*r),w=Math.cos(b);i.textAlign=Math.abs(w)<.2?"center":w>0?"left":"right",i.fillText(e.indicators[g].name,k,S)}i.restore()}}}}])}(),X=function(){function PolarGrid(e){var t;return _classCallCheck(this,PolarGrid),_defineProperty(t=_callSuper(this,PolarGrid,[_objectSpread2({interactive:!1},e)]),"coord",null),_defineProperty(t,"theme",null),_defineProperty(t,"layout",null),t}return _inherits(PolarGrid,I),_createClass(PolarGrid,[{key:"geometry",value:function geometry(){var e=this.coord;if(!e)return null;var t=e.plot,i=t.x+e.xScale.map(0),r=t.y+e.yScale.map(0);if(!isFinite(i)||!isFinite(r))return null;var n=Math.min(Math.abs(i-t.x),Math.abs(t.x+t.width-i),Math.abs(r-t.y),Math.abs(t.y+t.height-r));if(!(n>1))return null;var a=e.xScale.map(1)-e.xScale.map(0);return{cx:i,cy:r,radiusPx:n,rMax:Math.abs(a)>1e-9?n/Math.abs(a):0}}},{key:"doRender",value:function doRender(){var e=this.coord,t=this.theme;if(e&&t&&!1!==e.options.show){var i=this.geometry();if(i){var r=i.cx,n=i.cy,a=i.radiusPx,o=i.rMax,s=e.options,l=Math.max(1,Math.min(12,Number(s.splitNumber)||4)),h=Math.max(4,Math.min(36,Number(s.spokeCount)||12)),u=(Number(s.startAngle)||0)*Math.PI/180,c=this.unit(),d=this.ctx;d.beginPath(),d.save(),d.lineWidth=c,d.strokeStyle=t.splitLineColor;for(var f=1;f<=l;f++)d.beginPath(),d.arc(r,n,a*f/l,0,2*Math.PI),d.stroke();d.beginPath();for(var p=0;p<h;p++){var v=u+p/h*Math.PI*2;d.moveTo(r,n),d.lineTo(r+Math.cos(v)*a,n+Math.sin(v)*a)}if(d.stroke(),!1!==s.showLabels&&o>0){var m=u+Math.PI/4,g=Math.cos(m),b=Math.sin(m);this.setFont(t.fontSize,t.fontFamily),d.fillStyle=t.subTextColor,d.textBaseline="middle";for(var k=1;k<=l;k++){var S=o*k/l,w=r+g*(a*k/l),A=n+b*(a*k/l);d.textAlign=g>=0?"left":"right";var _=Math.abs(S)>=1?String(Number(S.toPrecision(3))):String(Number(S.toPrecision(2)));d.strokeStyle="transparent"===t.backgroundColor?"#ffffff":t.backgroundColor,d.lineWidth=3*c,d.strokeText(_,w+3*g*c,A+3*b*c),d.fillText(_,w+3*g*c,A+3*b*c),d.strokeStyle=t.splitLineColor,d.lineWidth=c}}d.restore()}}}}])}(),K=function(){function DataZoomSlider(e){var t;return _classCallCheck(this,DataZoomSlider),_defineProperty(t=_callSuper(this,DataZoomSlider,[_objectSpread2({interactive:!0},e)]),"theme",null),_defineProperty(t,"start",0),_defineProperty(t,"end",1),_defineProperty(t,"activePart",null),_defineProperty(t,"handleWidth",12),t}return _inherits(DataZoomSlider,I),_createClass(DataZoomSlider,[{key:"setWindow",value:function setWindow(e,t){var i=clamp$2(e,0,1),r=clamp$2(t,0,1);return Math.abs(i-this.start)<1e-6&&Math.abs(r-this.end)<1e-6?this:(this.start=i,this.end=r,this.markDirty())}},{key:"setActive",value:function setActive(e){return this.activePart===e?this:(this.activePart=e,this.markDirty())}},{key:"hitPart",value:function hitPart(e,t){var i=this.state,r=i.width,n=i.height;if(e<0||e>r||t<0||t>n)return null;var a=this.start*r,o=this.end*r,s=this.handleWidth/2;return Math.abs(e-a)<=s?"start":Math.abs(e-o)<=s?"end":e>a&&e<o?"window":"track"}},{key:"fractionAt",value:function fractionAt(e){return clamp$2(e/(this.state.width||1),0,1)}},{key:"doRender",value:function doRender(){if(this.theme){var e=this.ctx,t=this.state,i=t.width,r=t.height,n=this.unit(),a=Math.max(4,Math.round(.34*r)),o=(r-a)/2,s=this.start*i,l=this.end*i,h=this.theme.colorPalette[0],u=this.handleWidth;e.beginPath(),e.save(),e.fillStyle=this.theme.splitLineColor,roundRect(e,0,o,i,a,a/2),e.fill(),e.fillStyle=h,e.globalAlpha=.85,roundRect(e,s,o,Math.max(2,l-s),a,a/2),e.fill(),e.globalAlpha=1;for(var c=0,d=[[s,"start"],[l,"end"]];c<d.length;c++){var f=_slicedToArray(d[c],2),p=f[0],v=f[1],m=clamp$2(p-u/2,0,Math.max(0,i-u));e.fillStyle="#ffffff",e.strokeStyle=this.activePart===v?h:this.theme.axisLineColor,e.lineWidth=(this.activePart===v?2:1)*n,roundRect(e,m,1,u,r-2,3),e.fill(),e.stroke(),e.beginPath(),e.moveTo(m+u/2-2,o-3),e.lineTo(m+u/2-2,o+a+3),e.moveTo(m+u/2+2,o-3),e.lineTo(m+u/2+2,o+a+3),e.strokeStyle=this.theme.subTextColor,e.lineWidth=n,e.stroke()}e.restore()}}}])}(),G=function(){function SeriesBase(e,t){var i;return _classCallCheck(this,SeriesBase),_defineProperty(i=_callSuper(this,SeriesBase,[_objectSpread2({interactive:!0},t)]),"chartTheme",null),_defineProperty(i,"hiddenSlices",[]),_defineProperty(i,"coord",null),_defineProperty(i,"barSlot",{index:0,count:1}),_defineProperty(i,"pixels",new Float64Array(0)),_defineProperty(i,"effective",new Float64Array(0)),_defineProperty(i,"fromEffective",null),_defineProperty(i,"renderIndices",null),_defineProperty(i,"xMonotonic",!0),_defineProperty(i,"sizeExtent",[0,1]),_defineProperty(i,"itemProgress",new Float64Array(0)),_defineProperty(i,"stagger",0),_defineProperty(i,"animationKind","enter"),_defineProperty(i,"hoverIndex",null),_defineProperty(i,"cacheKey",""),_defineProperty(i,"supportsSampling",!0),_defineProperty(i,"clipToBox",!1),_defineProperty(i,"localBoxScratch",[0,0,0,0]),i.series=e,i}return _inherits(SeriesBase,I),_createClass(SeriesBase,[{key:"__localBox",value:function __localBox(){var e=this.paintPad(),t=this.localBoxScratch;return t[0]=-e,t[1]=-e,t[2]=(this.state.width||0)+e,t[3]=(this.state.height||0)+e,t}},{key:"paintPad",value:function paintPad(){var e=this.series.option,t=!1===e.showSymbol?0:this.maxSymbolSize()/2+4;return Math.max(t,(e.lineWidth||2)+4,6)}},{key:"symbolSizeAt",value:function symbolSizeAt(e){var t=this.series.option,i=this.series.points[e],r=t.symbolSize;if("function"==typeof r){var n=i?i.y:null,a=NaN;try{a=Number(r(n,{dataIndex:e,data:i?i.raw:void 0,seriesName:this.series.name}))}catch(e){a=NaN}return isFinite(a)&&a>0?a:8}if(i&&"number"==typeof i.size&&isFinite(i.size)){var o=Array.isArray(t.symbolSizeRange)?t.symbolSizeRange:[8,40],s=_slicedToArray(this.sizeExtent,2),l=s[0],h=s[1],u=h>l?(i.size-l)/(h-l):.5;return o[0]+(o[1]-o[0])*Math.max(0,Math.min(1,u))}var c=Number(r);return isFinite(c)&&c>0?c:8}},{key:"maxSymbolSize",value:function maxSymbolSize(){var e=this.series.option;if("function"==typeof e.symbolSize||this.series.points.some(function(e){return"number"==typeof e.size})){var t=Array.isArray(e.symbolSizeRange)?e.symbolSizeRange:[8,40];return Math.max(8,Number(t[1])||40)}var i=Number(e.symbolSize);return isFinite(i)&&i>0?i:8}},{key:"setCoord",value:function setCoord(e){return this.coord=e,this.cacheKey="",this.markDirty()}},{key:"setHiddenSlices",value:function setHiddenSlices(e){return this.hiddenSlices=e||[],this.markDirty()}},{key:"setAnimationStage",value:function setAnimationStage(e){return this.stagger=e&&isFinite(Number(e.stagger))?Math.max(0,Math.min(.95,Number(e.stagger))):0,this.animationKind=e&&"update"===e.kind?"update":"enter",this}},{key:"isEntering",value:function isEntering(){return"enter"===this.animationKind&&this.progress()<1}},{key:"progressFor",value:function progressFor(e,t){var i=this.progress();if(i>=1)return 1;if(this.stagger<=0||t<=1)return i;var r=1/(1+this.stagger),n=(i-e/(t-1)*this.stagger*r)/r;return n<=0?0:n>=1?1:n}},{key:"computeItemProgress",value:function computeItemProgress(){var e=this.series.points.length;this.itemProgress.length!==e&&(this.itemProgress=new Float64Array(e));for(var t=0;t<e;t++)this.itemProgress[t]=this.progressFor(t,e)}},{key:"getAnimationState",value:function getAnimationState(){return this.computeItemProgress(),{progress:this.progress(),kind:this.animationKind,stagger:this.stagger,itemProgress:Array.from(this.itemProgress)}}},{key:"setHoverIndex",value:function setHoverIndex(e){var t=void 0===e?null:e;if(this.hoverIndex!==t){var i=null!==this.hoverIndex;this.hoverIndex=t;var r=this.highlightT(),n=null===t?0:1;if(!shouldAnimate())return this.setState({highlightT:n}),void this.markDirty();var a=_objectSpread2({},this.props.animations||{});a.highlightT={from:r,to:n,duration:null===t?180:260,easing:null===t?"easeOutCubic":"springSnappy",startTime:void 0,finished:!1},this.props.animations=a,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),i||null===t||this.markDirty()}}},{key:"highlightT",value:function highlightT(){var e=Number(this.state.highlightT);return isFinite(e)?Math.max(0,Math.min(1.2,e)):0}},{key:"hoverBoost",value:function hoverBoost(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.12,i=arguments.length>2?arguments[2]:void 0;return this.hoverIndex!==e?1:1+t*(void 0===i?this.highlightT():Math.max(0,Math.min(1,i)))}},{key:"hoverAlpha",value:function hoverAlpha(e){return this.hoverIndex!==e?0:Math.max(0,Math.min(1,this.highlightT()))}},{key:"drawHoverOverlay",value:function drawHoverOverlay(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.hoverAlpha(e);if(!(r<=.01||t.width<=0||t.height<=0)){var n=this.ctx,a=this.unit(),o=Number(i.radius)||0;n.save(),n.globalAlpha=r,"none"!==i.fill&&(roundRect(n,t.x,t.y,t.width,t.height,o),n.fillStyle=i.fill||"rgba(255,255,255,0.16)",n.fill()),roundRect(n,t.x,t.y,t.width,t.height,o),n.strokeStyle=i.stroke||"rgba(255,255,255,0.95)",n.lineWidth=Math.max(a,(i.lineWidth||2)*a),n.stroke(),n.restore()}}},{key:"buildSeriesKey",value:function buildSeriesKey(e){return[].concat(_toConsumableArray(e),[this.coordKey(),this.progress(),this.animationKind,this.stagger]).join("|")}},{key:"coordKey",value:function coordKey(){var e=this.coord;if(!e)return"-";var t=[];e.plot&&t.push("p".concat(e.plot.x,",").concat(e.plot.y,",").concat(e.plot.width,",").concat(e.plot.height));for(var i=0,r=["xScale","yScale"];i<r.length;i++){var n=r[i],a=e[n],o=a&&a.domain;o&&o.length&&t.push("".concat(n,"[").concat(o.length,"]:").concat(String(o[0]),"~").concat(String(o[o.length-1])))}return t.join(";")}},{key:"updateSeries",value:function updateSeries(e,t){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]||(this.fromEffective=t&&this.effective.length===2*e.points.length?new Float64Array(this.effective):null),this.series=e,this.cacheKey="",this.markDirty()}},{key:"pixelAt",value:function pixelAt(e){this.rebuildPixels();var t=this.pixels[2*e],i=this.pixels[2*e+1];return isFinite(t)&&isFinite(i)?[t,i]:null}},{key:"barRectAt",value:function barRectAt(e){return null}},{key:"containsLocalPoint",value:function containsLocalPoint(e,t){return this.hitTestIndex(e,t)>=0}},{key:"progress",value:function progress(){var e=Number(this.state.progress);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"computeEffective",value:function computeEffective(){var e=this.series.points,t=e.length;this.effective.length!==2*t&&(this.effective=new Float64Array(2*t),this.fromEffective=null),this.computeItemProgress();for(var i=this.progress(),r=0;r<t;r++){var n=this.itemProgress[r],a=e[r],o=a.top;if(null!=o){var s=isFinite(a.base)?a.base:0,l=0,h=0;if(this.fromEffective){var u=this.fromEffective[2*r],c=this.fromEffective[2*r+1];isFinite(u)&&(l=u),isFinite(c)&&(h=c)}this.effective[2*r]=n>=1?s:l+(s-l)*n,this.effective[2*r+1]=n>=1?o:h+(o-h)*n}else this.effective[2*r]=NaN,this.effective[2*r+1]=NaN}i>=1&&(this.fromEffective=null)}},{key:"rebuildPixels",value:function rebuildPixels(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.coord;if(t){var i=this.buildCacheKey(t);if(e||i!==this.cacheKey){this.computeEffective();var r=this.series.points,n=r.length;this.pixels.length!==2*n&&(this.pixels=new Float64Array(2*n));for(var a=t.xScale,o=t.yScale,s=!0,l=-1/0,h=0;h<n;h++){var u=r[h],c=a.map(u.xValue),d=this.effective[2*h+1],f=isFinite(d)?o.map(d):NaN;this.pixels[2*h]=c,this.pixels[2*h+1]=f,isFinite(c)&&(c<l&&(s=!1),l=c)}this.xMonotonic=s,this.sizeExtent=function computeSizeExtent(e){var t,i=1/0,r=-1/0,n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){var a=t.value;"number"==typeof a.size&&isFinite(a.size)&&(a.size<i&&(i=a.size),a.size>r&&(r=a.size))}}catch(e){n.e(e)}finally{n.f()}return isFinite(i)?i===r?[i,i+1]:[i,r]:[0,1]}(r),this.renderIndices=this.buildRenderIndices(n,t.plot.width),this.cacheKey=i}}else this.pixels=new Float64Array(0)}},{key:"buildRenderIndices",value:function buildRenderIndices(e,t){if(!this.supportsSampling||!this.xMonotonic)return null;var i=this.series.option;if("none"===i.sampling)return null;if(!i.sampling&&e<=Math.max(2e3,3*t))return null;var r=Math.max(64,Math.min(e,Math.floor(2*t)));return e<=r+2?null:function lttbIndices(e,t,i){if(i>=t||i<=2){for(var r=[],n=0;n<t;n++)r.push(n);return r}for(var a=[0],o=(t-2)/(i-2),s=0,l=0;l<i-2;l++){var h=Math.floor((l+1)*o)+1,u=Math.floor((l+2)*o)+1;u>t&&(u=t);for(var c=0,d=0,f=0;h<u;h++){var p=e[2*h+1];isFinite(p)&&(c+=e[2*h],d+=p,f++)}f?(c/=f,d/=f):(c=e[2*(t-1)],d=e[2*(t-1)+1],isFinite(d)||(d=e[2*s+1],c=e[2*s]));for(var v=Math.floor(l*o)+1,m=Math.min(Math.floor((l+1)*o)+1,t-1),g=e[2*s],b=e[2*s+1],k=-1,S=v,w=v;w<m;w++){var A=e[2*w+1];if(isFinite(A)){var _=e[2*w],M=Math.abs((g-c)*(A-b)-(g-_)*(d-b));M>k&&(k=M,S=w)}}a.push(S),s=S}return a.push(t-1),a}(this.pixels,e,r)}},{key:"renderCount",value:function renderCount(){return this.renderIndices?this.renderIndices.length:this.pixels.length/2}},{key:"renderIndexAt",value:function renderIndexAt(e){return this.renderIndices?this.renderIndices[e]:e}},{key:"nearestIndexAtX",value:function nearestIndexAtX(e){var t=this;this.rebuildPixels();var i=this.pixels.length/2;if(!i)return-1;if(!this.xMonotonic){for(var r=-1,n=1/0,a=0;a<i;a++){var o=this.pixels[2*a];if(isFinite(o)){var s=Math.abs(o-e);s<n&&(n=s,r=a)}}return r}for(var l=0,h=i-1;l<h;){var u=l+h>>1,c=this.pixels[2*u];!isFinite(c)||c<e?l=u+1:h=u}var d,f=[l,l-1].filter(function(e){return e>=0&&e<i&&isFinite(t.pixels[2*e])}),p=-1,v=1/0,m=_createForOfIteratorHelper(f);try{for(m.s();!(d=m.n()).done;){var g=d.value,b=Math.abs(this.pixels[2*g]-e);b<v&&(v=b,p=g)}}catch(e){m.e(e)}finally{m.f()}return p}},{key:"buildCacheKey",value:function buildCacheKey(e){var t=e.xScale.domain,i=e.yScale.domain;return[this.series.points.length,this.progress(),e.plot.width,e.plot.height,String(t[0]),String(t[t.length-1]),String(i[0]),String(i[1]),this.series.points.length?String(this.series.points[0].xValue):""].join("|")}},{key:"eachSegment",value:function eachSegment(e){for(var t=this.pixels.length/2,i=0;i<t-1;i++){var r=this.pixels[2*i],n=this.pixels[2*i+1],a=this.pixels[2*(i+1)],o=this.pixels[2*(i+1)+1];isFinite(r)&&isFinite(n)&&isFinite(a)&&isFinite(o)&&e(r,n,a,o,i)}}},{key:"pointColor",value:function pointColor(e){return this.series.option.color||this.series.color}},{key:"lineWidthDevice",value:function lineWidthDevice(){var e=this.series.option.lineWidth;return isFinite(e)?e:2}},{key:"opacity",value:function opacity(){var e=Number(this.series.option.opacity);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"beginDraw",value:function beginDraw(){this.ctx.beginPath(),this.ctx.save(),this.clipToBox&&(this.ctx.beginPath(),this.ctx.rect(0,0,this.state.width,this.state.height),this.ctx.clip()),this.ctx.lineJoin="round",this.ctx.lineCap="round",this.ctx.globalAlpha=this.opacity()}},{key:"endDraw",value:function endDraw(){this.ctx.restore()}},{key:"drawSymbol",value:function drawSymbol(e,t,i,r,n,a){var o=this.ctx,s=this.unit();o.beginPath(),"rect"===i?o.rect(e-r/2,t-r/2,r,r):o.arc(e,t,Math.max(1,r/2),0,2*Math.PI),n&&(o.fillStyle=n,o.fill()),a&&(o.strokeStyle=a,o.lineWidth=s,o.stroke())}},{key:"pointByIndex",value:function pointByIndex(e){return this.series.points[e]||null}}])}();var Y=function(){function LineSeries(){var e;_classCallCheck(this,LineSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,LineSeries,[].concat(i)),"seriesType","line"),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"fillArea",!1),e}return _inherits(LineSeries,G),_createClass(LineSeries,[{key:"doRender",value:function doRender(){this.rebuildPixels();var e=this.renderPoints();if(e.length){var t=this.series.option,i=this.pointColor(0),r=this.unit(),n=this.lineWidthDevice()*r,a=t.symbol||"circle",o=!0===t.showSymbol||"scatter"===this.seriesType,s=this.ctx;if(this.beginDraw(),this.fillArea&&this.drawArea(i,e),s.beginPath(),s.strokeStyle=i,s.lineWidth=n,"function"==typeof s.setLineDash&&Array.isArray(t.lineDash)&&s.setLineDash(t.lineDash.map(function(e){return e*r})),t.smooth?this.drawSmoothLine(e,"number"==typeof t.smooth?t.smooth:.5):this.drawStraightLine(e),s.stroke(),"function"==typeof s.setLineDash&&s.setLineDash([]),o&&"none"!==a)for(var l=t.symbolFill||i,h=t.symbolStroke||"#ffffff",u=0;u<e.length;u++){var c=e[u];this.drawSymbol(c[0],c[1],a,this.symbolSizeAt(this.renderIndexAt(u)),l,h)}this.endDraw()}}},{key:"renderPoints",value:function renderPoints(){var e=[],t=this.renderCount();this.isEntering()&&(t=Math.max(1,Math.ceil(t*this.progress())));for(var i=0;i<t;i++){var r=this.renderIndexAt(i),n=this.pixels[2*r],a=this.pixels[2*r+1];isFinite(n)&&isFinite(a)&&e.push([n,a])}return e}},{key:"revealedPointCount",value:function revealedPointCount(){return this.rebuildPixels(),this.renderPoints().length}},{key:"drawStraightLine",value:function drawStraightLine(e){for(var t=this.ctx,i=0;i<e.length;i++)0===i?t.moveTo(e[i][0],e[i][1]):t.lineTo(e[i][0],e[i][1])}},{key:"drawSmoothLine",value:function drawSmoothLine(e,t){var i=this.ctx,r=Math.max(.05,Math.min(1,t))/3;if(e.length<2)1===e.length&&i.moveTo(e[0][0],e[0][1]);else{i.moveTo(e[0][0],e[0][1]);for(var n=0;n<e.length-1;n++){var a=n>0?e[n-1]:e[n],o=e[n],s=e[n+1],l=n+2<e.length?e[n+2]:s,h=o[0]+(s[0]-a[0])*r,u=o[1]+(s[1]-a[1])*r,c=s[0]-(l[0]-o[0])*r,d=s[1]-(l[1]-o[1])*r;i.bezierCurveTo(h,u,c,d,s[0],s[1])}}}},{key:"drawArea",value:function drawArea(e,t){var i=this.coord;if(i&&!(t.length<2)){var r=this.ctx;r.beginPath(),r.moveTo(t[0][0],this.baselineYFor(t,0));var n,a=_createForOfIteratorHelper(t);try{for(a.s();!(n=a.n()).done;){var o=_slicedToArray(n.value,2),s=o[0],l=o[1];r.lineTo(s,l)}}catch(e){a.e(e)}finally{a.f()}for(var h=t.length-1;h>=0;h--)r.lineTo(t[h][0],this.baselineYFor(t,h));r.closePath();var u=Number(this.series.option.areaOpacity),c=isFinite(u)?Math.max(0,Math.min(1,u)):.28,d=r.createLinearGradient?r.createLinearGradient(0,0,0,i.plot.height):null;d?(d.addColorStop(0,hexToRgba(e,c)),d.addColorStop(1,hexToRgba(e,.02)),r.fillStyle=d):r.fillStyle=hexToRgba(e,c),r.fill()}}},{key:"baselineYFor",value:function baselineYFor(e,t){var i=this.coord;if(!i)return 0;var r=this.renderIndexAt(t),n=this.effective[2*r];return isFinite(n)?i.yScale.map(n):i.plot.height}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var i=this.pixels.length/2;if(!i)return-1;var r=this.series.option,n=r.hitRadius?Number(r.hitRadius):Math.max(8,this.maxSymbolSize()/2+4);if(i>1024&&this.xMonotonic){var a=this.nearestIndexAtX(e);if(a<0)return-1;for(var o=-1,s=n*n,l=Math.max(0,a-2),h=Math.min(i-1,a+2),u=l;u<=h;u++){var c=this.pixels[2*u],d=this.pixels[2*u+1];if(isFinite(c)&&isFinite(d)){var f=c-e,p=d-t,v=f*f+p*p;v<=s&&(s=v,o=u)}}if(o>=0)return o;for(var m=Math.max(4,this.lineWidthDevice()+4),g=Math.max(0,a-1);g<=Math.min(i-2,a);g++){if(distanceToSegment(e,t,this.pixels[2*g],this.pixels[2*g+1],this.pixels[2*(g+1)],this.pixels[2*(g+1)+1])<=m)return Math.abs(e-this.pixels[2*g])<=Math.abs(e-this.pixels[2*(g+1)])?g:g+1}return-1}for(var b=-1,k=n*n,S=0;S<i;S++){var w=this.pixels[2*S],A=this.pixels[2*S+1];if(isFinite(w)&&isFinite(A)){var _=w-e,M=A-t,C=_*_+M*M;C<=k&&(k=C,b=S)}}if(b>=0)return b;var T=Math.max(4,this.lineWidthDevice()+4),P=-1;return this.eachSegment(function(i,r,n,a,o){P>=0||distanceToSegment(e,t,i,r,n,a)<=T&&(P=Math.abs(e-i)<=Math.abs(e-n)?o:o+1)}),P}}])}();function distanceToSegment(e,t,i,r,n,a){var o=n-i,s=a-r,l=o*o+s*s;if(0===l)return Math.hypot(e-i,t-r);var h=((e-i)*o+(t-r)*s)/l;return h=Math.max(0,Math.min(1,h)),Math.hypot(e-(i+h*o),t-(r+h*s))}function hexToRgba(e,t){if(!e)return"rgba(0,0,0,".concat(t,")");if(0===e.indexOf("rgba"))return e;if(0===e.indexOf("rgb("))return e.replace("rgb(","rgba(").replace(")",",".concat(t,")"));var i=e.replace("#","");if(3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),6!==i.length)return e;var r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return"rgba(".concat(r,",").concat(n,",").concat(a,",").concat(t,")")}var q=function(){function BarSeries(){var e;_classCallCheck(this,BarSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,BarSeries,[].concat(i)),"seriesType","bar"),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"barCacheKey",""),e}return _inherits(BarSeries,G),_createClass(BarSeries,[{key:"isHorizontal",value:function isHorizontal(){var e=this.coord;return!!e&&e.yScale.isBand()&&!e.xScale.isBand()}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord,t=this.series.points.length;if(e){var i=this.buildSeriesKey([t,e.plot.width,e.plot.height,this.isHorizontal()?"h":"v",String(e.yScale.domain.join(","))]);if(i!==this.barCacheKey||this.pixels.length!==2*t){this.barCacheKey=i,this.computeEffective(),this.pixels.length!==2*t&&(this.pixels=new Float64Array(2*t));for(var r=0;r<t;r++){var n=this.barRectAt(r);n?(this.pixels[2*r]=n.x+n.width/2,this.pixels[2*r+1]=n.y+n.height/2):(this.pixels[2*r]=NaN,this.pixels[2*r+1]=NaN)}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"barRectAt",value:function barRectAt(e){var t=this.coord,i=this.series.points[e];if(!t||!i)return null;this.effective.length!==2*this.series.points.length&&this.computeEffective();var r=this.effective[2*e+1],n=this.effective[2*e];if(!isFinite(r))return null;if(this.isHorizontal()){var a=t.yScale.bandStart(i.xValue);if(!isFinite(a))return null;var o=t.yScale.bandwidth()||.6*t.yScale.step(),s=o/Math.max(1,this.barSlot.count),l=this.resolveBarWidth(o,s),h=t.yScale.range[1]>=t.yScale.range[0]?1:-1,u=a+h*(s*this.barSlot.index+(s-l)/2),c=h>0?u:u-l,d=t.xScale.map(n),f=t.xScale.map(r);return isFinite(d)&&isFinite(f)?{x:Math.min(d,f),y:c,width:Math.abs(f-d),height:l}:null}var p=t.xScale.bandStart(i.xValue);if(!isFinite(p))return null;var v=t.xScale.bandwidth()||.6*t.xScale.step(),m=v/Math.max(1,this.barSlot.count),g=this.resolveBarWidth(v,m),b=p+m*this.barSlot.index+(m-g)/2,k=t.yScale.map(n),S=t.yScale.map(r);return isFinite(k)&&isFinite(S)?{x:b,y:Math.min(k,S),width:g,height:Math.abs(S-k)}:null}},{key:"resolveBarWidth",value:function resolveBarWidth(e,t){var i=this.series.option,r=Number(i.barWidth);return!isFinite(r)||r<=0?Math.max(1,t*(1-(isFinite(Number(i.barGap))?Number(i.barGap):.2))):r<=1?Math.max(1,e*r):Math.max(1,r*this.unit())}},{key:"barColorAt",value:function barColorAt(e){var t=this.series.points[e],i=t&&t.raw;return(i&&"object"===_typeof(i)&&!Array.isArray(i)?i.color:void 0)||this.pointColor(e)}},{key:"barDrawRectAt",value:function barDrawRectAt(e,t){var i=this.barRectAt(e),r=this.coord;if(!i||!r)return i;var n=this.hoverBoost(e,.08,t)-1;if(n<=0)return i;var a=this.effective[2*e];if(this.isHorizontal()){var o=i.width*n;return i.x+i.width/2>=r.xScale.map(a)?{x:i.x,y:i.y,width:i.width+o,height:i.height}:{x:i.x-o,y:i.y,width:i.width+o,height:i.height}}var s=i.height*n;return i.y+i.height/2<=r.yScale.map(a)?{x:i.x,y:i.y-s,width:i.width,height:i.height+s}:{x:i.x,y:i.y,width:i.width,height:i.height+s}}},{key:"doRender",value:function doRender(){if(this.rebuildPixels(),this.coord){var e=Number(this.series.option.barRadius),t=this.ctx;this.beginDraw();for(var i=0;i<this.series.points.length;i++){var r=this.barDrawRectAt(i);if(r&&!(r.height<=0)){var n=this.barColorAt(i),a=r;if(t.beginPath(),roundRect(t,a.x,a.y,a.width,a.height,isFinite(e)?e:0),t.createLinearGradient){var o=this.isHorizontal()?t.createLinearGradient(a.x,0,a.x+a.width,0):t.createLinearGradient(0,a.y,0,a.y+a.height);o.addColorStop(0,hexToRgba(n,.95)),o.addColorStop(1,hexToRgba(n,.7)),t.fillStyle=o}else t.fillStyle=n;t.fill()}}this.endDraw()}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();for(var i=this.series.points.length,r=0;r<i;r++){var n=this.barRectAt(r);if(n&&(e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height))return r}return-1}}])}(),$=function(){function AreaSeries(e,t){var i;return _classCallCheck(this,AreaSeries),_defineProperty(i=_callSuper(this,AreaSeries,[e,t]),"seriesType","area"),i.fillArea=!0,i}return _inherits(AreaSeries,Y),_createClass(AreaSeries)}(),Z=function(){function ScatterSeries(){var e;_classCallCheck(this,ScatterSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,ScatterSeries,[].concat(i)),"seriesType","scatter"),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"clipToBox",!0),e}return _inherits(ScatterSeries,G),_createClass(ScatterSeries,[{key:"doRender",value:function doRender(){this.rebuildPixels();var e=this.pixels.length/2;if(e){var t=this.series.option,i=this.pointColor(0),r=t.symbol||"circle",n=t.symbolFill||i,a=t.symbolStroke||"#ffffff";this.beginDraw();var o=this.isEntering();this.computeItemProgress();for(var s=0;s<e;s++){var l=this.pixels[2*s],h=this.pixels[2*s+1];if(isFinite(l)&&isFinite(h)){var u=o?this.itemProgress[s]:1;if(!(u<=0)){var c=this.symbolSizeAt(s)*(o?.2+.8*u:1)*this.hoverBoost(s,.18);o&&u<1&&(this.ctx.globalAlpha=.25+.75*u),this.drawSymbol(l,h,r,c,n,a),o&&u<1&&(this.ctx.globalAlpha=1)}}}this.endDraw()}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var i=this.series.option,r=i.hitRadius?Number(i.hitRadius):this.maxSymbolSize()/2+4,n=r*r,a=-1,o=n,s=this.pixels.length/2;if(s>1024&&this.xMonotonic){var l=this.nearestIndexAtX(e);if(l<0)return-1;for(var h=-1,u=n,c=Math.max(0,l-3);c<=Math.min(s-1,l+3);c++){var d=this.pixels[2*c]-e,f=this.pixels[2*c+1]-t,p=d*d+f*f;p<=u&&(u=p,h=c)}return h}for(var v=0;v<s;v++){var m=this.pixels[2*v],g=this.pixels[2*v+1];if(isFinite(m)&&isFinite(g)){var b=m-e,k=g-t,S=b*b+k*k;S<=o&&(o=S,a=v)}}return a}}])}(),J=2*Math.PI;function normalizeAngle(e){return(e%J+J)%J}function shortestAngleDelta(e,t){var i=normalizeAngle(t-e);return i>Math.PI&&(i-=J),i}var Q=function(){function PieSeries(){var e;_classCallCheck(this,PieSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,PieSeries,[].concat(i)),"seriesType","pie"),_defineProperty(e,"polar",null),_defineProperty(e,"slices",new Float64Array(0)),_defineProperty(e,"pieCacheKey",""),_defineProperty(e,"sliceFrom",null),e}return _inherits(PieSeries,G),_createClass(PieSeries,[{key:"setCoord",value:function setCoord(e){return this.polar=e||null,this.pieCacheKey="",this.markDirty()}},{key:"setHiddenSlices",value:function setHiddenSlices(e){return e.join(",")!==this.hiddenSlices.join(",")&&this.slices.length&&(this.sliceFrom=new Float64Array(this.slices)),_superPropGet(PieSeries,"setHiddenSlices",this,3)([e]),this.pieCacheKey="",this}},{key:"paintPad",value:function paintPad(){var e=this.series.option.label;return e&&!1===e.show?4:48}},{key:"localCenter",value:function localCenter(){var e=this.polar;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.polar,t=this.series.points;if(!e)return this.pixels=new Float64Array(0),void(this.slices=new Float64Array(0));var i=this.series.option,r=[t.length,i.startAngle,i.clockwise,i.roseType,i.radius,i.innerRadius,e.polar.radius,e.plot.width,this.hiddenSlices.join(","),this.progress(),t.length?String(t[0].y):""].join("|");if(r!==this.pieCacheKey){this.pieCacheKey=r;var n=t.length;this.pixels.length!==2*n&&(this.pixels=new Float64Array(2*n)),this.slices.length!==4*n&&(this.slices=new Float64Array(4*n));for(var a=_slicedToArray(this.localCenter(),2),o=a[0],s=a[1],l=e.polar.radius,h=0,u=0,c=0;c<n;c++)if(!(this.hiddenSlices.indexOf(c)>=0)){var d=t[c].y||0;d>0&&(h+=d),d>u&&(u=d)}this.computeItemProgress();for(var f=!1===i.clockwise?-1:1,p=-(void 0===i.startAngle?90:Number(i.startAngle))*Math.PI/180,v=Math.max(0,Math.min(.95,Number(i.innerRadius)||0)),m=i.roseType,g=0;g<n;g++){var b=this.hiddenSlices.indexOf(g)>=0,k=b?0:t[g].y||0,S=p,w=p+f*(h>0?k/h*J*(b?0:this.itemProgress[g]):0);p=w;var A=l;m&&u>0&&(A="area"===m?l*Math.sqrt(Math.max(0,k)/u):l*(Math.max(0,k)/u),A=Math.max(3,A));var _=l*v;this.slices[4*g]=S,this.slices[4*g+1]=w,this.slices[4*g+2]=_,this.slices[4*g+3]=A}this.blendSliceMorph(this.isEntering());for(var M=0;M<n;M++)this.writeCentroid(M,o,s)}}},{key:"blendSliceMorph",value:function blendSliceMorph(e){var t=this.sliceFrom;if(!(!t||e||t.length<this.slices.length)){var i=Math.max(0,Math.min(1,this.progress()));if(i>=1)this.sliceFrom=null;else for(var r=0;r<this.slices.length/4;r++){var n=t[4*r],a=this.slices[4*r],o=n+shortestAngleDelta(n,a)*i,s=t[4*r+1]-n,l=this.slices[4*r+1]-a;this.slices[4*r]=o,this.slices[4*r+1]=o+s+(l-s)*i;for(var h=0,u=[2,3];h<u.length;h++){var c=u[h],d=t[4*r+c];this.slices[4*r+c]=d+(this.slices[4*r+c]-d)*i}}}}},{key:"writeCentroid",value:function writeCentroid(e,t,i){var r=this.slices[4*e],n=this.slices[4*e+1],a=this.slices[4*e+2],o=this.slices[4*e+3];if(Math.abs(n-r)<=1e-9)return this.pixels[2*e]=NaN,void(this.pixels[2*e+1]=NaN);var s=(r+n)/2,l=a+.6*(o-a);this.pixels[2*e]=t+Math.cos(s)*l,this.pixels[2*e+1]=i+Math.sin(s)*l}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.polar;if(!i)return-1;this.rebuildPixels();var r=_slicedToArray(this.localCenter(),2),n=e-r[0],a=t-r[1],o=Math.hypot(n,a);if(o>i.polar.radius+4)return-1;for(var s=this.series.points.length,l=Math.atan2(a,n),h=0;h<s;h++){var u=this.slices[4*h],c=this.slices[4*h+1],d=this.slices[4*h+2],f=this.slices[4*h+3],p=Math.abs(c-u);if(!(p<=1e-9))if(!(o<d-1))if(normalizeAngle(c>u?l-u:u-l)<=p+1e-9&&o<=f+4)return h}return-1}},{key:"doRender",value:function doRender(){var e=this,t=this.polar;if(t){this.rebuildPixels();for(var i=this.ctx,r=_slicedToArray(this.localCenter(),2),n=r[0],a=r[1],o=this.unit(),s=!1===this.series.option.clockwise?-1:1,l=this.series.points.length,h=this.series.option.label,u=!(h&&!1===h.show)&&l>0&&l<=16,c=h&&"inside"===h.position,d=0,f=0;f<l;f++)if(!(this.hiddenSlices.indexOf(f)>=0)){var p=this.series.points[f].y||0;p>0&&(d+=p)}this.beginDraw();for(var v=0;v<l;v++){var m=this.slices[4*v],g=this.slices[4*v+1],b=this.slices[4*v+2],k=this.slices[4*v+3];if(!(Math.abs(g-m)<=1e-9)){var S=this.series.points[v].color||this.series.color,w=this.hoverBoost(v,1),A=w>1?7*(w-1)*this.unit():0,_=(m+g)/2,M=Math.cos(_)*A,C=Math.sin(_)*A;i.beginPath(),b>0?(i.arc(n+M,a+C,k,m,g,s<0),i.arc(n+M,a+C,b,g,m,s>0)):(i.moveTo(n+M,a+C),i.arc(n+M,a+C,k,m,g,s<0)),i.closePath(),i.fillStyle=S,i.fill(),l>1&&(i.strokeStyle="rgba(255,255,255,0.85)",i.lineWidth=o,i.stroke())}}if(u){this.setFont(this.fontSize(),this.fontFamily());for(var T=NaN,P=0,I=[],O=0;O<l;O++){var N=this.slices[4*O],D=this.slices[4*O+1],H=this.slices[4*O+2],R=this.slices[4*O+3];if(!(Math.abs(D-N)<=1e-9)){var E=this.series.points[O],L=E.y||0,z=t.polar.radius,B=d>0?L/d*100:0,W={name:E.name||"".concat(this.series.name," ").concat(O+1),value:E.y,percent:B,dataIndex:O,seriesId:this.series.id,seriesName:this.series.name,color:E.color||this.series.color},V=h&&"function"==typeof h.formatter?String(h.formatter(W)):"".concat(W.name," ").concat(B.toFixed(1),"%"),j=(N+D)/2;if(c){if(isFinite(T))P=Math.abs(Math.atan2(Math.sin(j-T),Math.cos(j-T)))<.42?Math.min(3,P+1):0;else P=0;T=j;var U=H+.62*(R-H)+P*(this.fontSize()+4),X=Math.abs(D-N)*U;if(measureTextWidth(this.ctx,V,this.fontSize(),this.fontFamily())<=X+6){i.textAlign="center",i.textBaseline="middle",i.fillStyle="#ffffff",i.fillText(V,n+Math.cos(j)*U,a+Math.sin(j)*U);continue}}var K=z+8,G=z+26,Y=Math.cos(j)>=0;I.push({x1:n+Math.cos(j)*R,y1:a+Math.sin(j)*R,x2:n+Math.cos(j)*K,y2:a+Math.sin(j)*K,x3:n+Math.cos(j)*G+(Y?8:-8),y3:a+Math.sin(j)*G,text:V,right:Y})}}for(var q=1.45*this.fontSize(),$=function _loop(){for(var r=J[Z],n=I.filter(function(e){return e.right===r}).sort(function(e,t){return e.y3-t.y3}),s=1;s<n.length;s++)n[s].y3-n[s-1].y3<q&&(n[s].y3=n[s-1].y3+q);if(n.length){var l=n[n.length-1].y3-(a+t.polar.radius+2*q);if(l>0){var h,u=_createForOfIteratorHelper(n);try{for(u.s();!(h=u.n()).done;){h.value.y3-=l}}catch(e){u.e(e)}finally{u.f()}}}var c,d=_createForOfIteratorHelper(n);try{for(d.s();!(c=d.n()).done;){var f=c.value;i.strokeStyle="rgba(148,163,184,0.9)",i.lineWidth=o,i.beginPath(),i.moveTo(f.x1,f.y1),i.lineTo(f.x2,f.y2),i.lineTo(f.x2,f.y3),i.lineTo(f.x3,f.y3),i.stroke(),i.textAlign=f.right?"left":"right",i.textBaseline="middle",i.fillStyle=e.chartTheme&&e.chartTheme.axisLabelColor||"#475569",i.fillText(f.text,f.x3+(f.right?4:-4)*o,f.y3)}}catch(e){d.e(e)}finally{d.f()}},Z=0,J=[!0,!1];Z<J.length;Z++)$()}this.endDraw()}}},{key:"fontSize",value:function fontSize(){return this.chartTheme&&this.chartTheme.fontSize||12}},{key:"fontFamily",value:function fontFamily(){return this.chartTheme&&this.chartTheme.fontFamily||"Arial"}}])}(),ee=function(){function RadarSeries(){var e;_classCallCheck(this,RadarSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,RadarSeries,[].concat(i)),"seriesType","radar"),_defineProperty(e,"radar",null),_defineProperty(e,"radarCacheKey",""),e}return _inherits(RadarSeries,G),_createClass(RadarSeries,[{key:"setCoord",value:function setCoord(e){return this.radar=e||null,this.radarCacheKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 14}},{key:"localCenter",value:function localCenter(){var e=this.radar;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.radar,t=this.series.points,i=t.length;if(e){var r=[i,e.polar.radius,e.plot.width,this.progress(),e.domains.map(function(e){return e.join(":")}).join("|")].join("::");if(r!==this.radarCacheKey||this.pixels.length!==2*i){this.radarCacheKey=r,this.pixels.length!==2*i&&(this.pixels=new Float64Array(2*i));for(var n=_slicedToArray(this.localCenter(),2),a=n[0],o=n[1],s=this.progress(),l=0;l<i;l++){var h=-Math.PI/2+l/Math.max(1,i)*Math.PI*2,u=e.domains[l]||[0,1],c=t[l].y,d=null==c?u[0]:c,f=u[1]-u[0],p=f>0?(d-u[0])/f:0;p=Math.max(0,Math.min(1,p)),p*=s;var v=e.polar.radius*p;this.pixels[2*l]=a+Math.cos(h)*v,this.pixels[2*l+1]=o+Math.sin(h)*v}}}else this.pixels=new Float64Array(0)}},{key:"doRender",value:function doRender(){if(this.radar){this.rebuildPixels();var e=this.pixels.length/2;if(e){var t=this.ctx,i=this.pointColor(0),r=this.unit(),n=_slicedToArray(this.localCenter(),2);n[0],n[1],this.beginDraw(),t.beginPath();for(var a=0;a<e;a++){var o=this.pixels[2*a],s=this.pixels[2*a+1];0===a?t.moveTo(o,s):t.lineTo(o,s)}t.closePath(),t.fillStyle=hexToRgba(i,.22),t.fill(),t.strokeStyle=i,t.lineWidth=this.lineWidthDevice()*r,t.stroke();for(var l=0;l<e;l++){var h=this.hoverBoost(l,.3);this.drawSymbol(this.pixels[2*l],this.pixels[2*l+1],"circle",this.symbolSizeAt(l)*h,i,"#ffffff")}this.endDraw()}}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var i=this.pixels.length/2;if(!i)return-1;for(var r=this.series.option,n=r.hitRadius?Number(r.hitRadius):24,a=-1,o=n*n,s=0;s<i;s++){var l=this.pixels[2*s]-e,h=this.pixels[2*s+1]-t,u=l*l+h*h;u<=o&&(o=u,a=s)}if(a>=0)return a;if(this.containsPointInPolygon(e,t)){var c=_slicedToArray(this.localCenter(),2),d=c[0],f=c[1],p=Math.atan2(t-f,e-d),v=2*Math.PI/i,m=((p+Math.PI/2)%(2*Math.PI)+2*Math.PI)%(2*Math.PI);return Math.round(m/v)%i}return-1}},{key:"containsPointInPolygon",value:function containsPointInPolygon(e,t){for(var i=this.pixels.length/2,r=!1,n=0,a=i-1;n<i;a=n++){var o=this.pixels[2*n],s=this.pixels[2*n+1],l=this.pixels[2*a],h=this.pixels[2*a+1];s>t!=h>t&&e<(l-o)*(t-s)/(h-s)+o&&(r=!r)}return r}}])}(),te=function(){function CandlestickSeries(){var e;_classCallCheck(this,CandlestickSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,CandlestickSeries,[].concat(i)),"seriesType","candlestick"),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"clipToBox",!0),e}return _inherits(CandlestickSeries,G),_createClass(CandlestickSeries,[{key:"hitTestIndex",value:function hitTestIndex(e,t){for(var i=this.candleRects(),r=0;r<i.length;r++){var n=i[r];if(n&&(e>=n.x-2&&e<=n.x+n.width+2&&t>=n.y-2&&t<=n.y+n.height+2))return r}return-1}},{key:"candleRects",value:function candleRects(){var e=this.coord;if(!e)return[];for(var t=[],i=e.xScale.bandwidth()||.6*e.xScale.step(),r=this.resolveBodyWidth(i),n=0;n<this.series.points.length;n++){var a=this.series.points[n];if(a.ohlc){var o=(e.xScale.isBand(),e.xScale.map(a.xValue));if(isFinite(o)){var s=e.yScale.map(a.ohlc[3]),l=e.yScale.map(a.ohlc[2]);isFinite(s)&&isFinite(l)?t.push({x:o-r/2,y:Math.min(s,l),width:r,height:Math.abs(l-s)}):t.push(null)}else t.push(null)}else t.push(null)}return t}},{key:"resolveBodyWidth",value:function resolveBodyWidth(e){var t=Number(this.series.option.barWidth);return!isFinite(t)||t<=0?Math.max(2,.6*e):t<=1?Math.max(2,e*t):Math.max(2,t*this.unit())}},{key:"doRender",value:function doRender(){var e=this,t=this.coord;if(t){var i=this.ctx,r=this.unit(),n=this.series.option.candle||{},a=n.upColor||"#EF4444",o=n.downColor||"#10B981",s=Math.max(r,(Number(n.borderWidth)||1)*r),l=t.xScale.bandwidth()||.6*t.xScale.step(),h=this.resolveBodyWidth(l),u=this.candleRects(),c=this.isEntering();this.computeItemProgress(),this.beginDraw();for(var d=function _loop(){var r=e.series.points[f],n=u[f];if(!r.ohlc||!n)return 0;var l=_slicedToArray(r.ohlc,4),d=l[0],p=l[1],v=l[2],m=l[3],g=p>=d,b=g?a:o,k=n.x+n.width/2,S=c?e.itemProgress[f]:1;if(S<=0)return 0;var w=t.yScale.map(d),A=t.yScale.map(p),_=t.yScale.map(v),M=t.yScale.map(m),C=w,T=function lerp(e){return C+(e-C)*S};i.beginPath(),i.moveTo(k,T(M)),i.lineTo(k,T(_)),i.strokeStyle=b,i.lineWidth=s,i.stroke();var P=T(A),I=Math.min(w,P),O=Math.max(s,Math.abs(P-w));i.beginPath(),i.rect(k-h/2,I,h,O),i.fillStyle=b,i.globalAlpha=g?.55:.95,i.fill(),i.globalAlpha=1,i.strokeStyle=b,i.lineWidth=s,i.stroke()},f=0;f<this.series.points.length;f++)d();if(null!==this.hoverIndex){var p=u[this.hoverIndex];p&&this.drawHoverOverlay(this.hoverIndex,p,{radius:2,fill:"rgba(255,255,255,0.10)"})}this.endDraw()}}}])}(),ie=function(){function HeatmapSeries(){var e;_classCallCheck(this,HeatmapSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,HeatmapSeries,[].concat(i)),"seriesType","heatmap"),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"heatCacheKey",""),e}return _inherits(HeatmapSeries,G),_createClass(HeatmapSeries,[{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord,t=this.series.points.length;if(e){var i=this.buildSeriesKey([t,e.plot.width,e.plot.height,String(e.yScale.domain.join(","))]);if(i!==this.heatCacheKey||this.pixels.length!==2*t){this.heatCacheKey=i,this.pixels.length!==2*t&&(this.pixels=new Float64Array(2*t));for(var r=0;r<t;r++){var n=this.cellRectAt(r);n?(this.pixels[2*r]=n.x+n.width/2,this.pixels[2*r+1]=n.y+n.height/2):(this.pixels[2*r]=NaN,this.pixels[2*r+1]=NaN)}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"valueRange",value:function valueRange(){var e,t=1/0,i=-1/0,r=_createForOfIteratorHelper(this.series.points);try{for(r.s();!(e=r.n()).done;){var n=e.value;null!==n.y&&isFinite(n.y)&&(n.y<t&&(t=n.y),n.y>i&&(i=n.y))}}catch(e){r.e(e)}finally{r.f()}return isFinite(t)&&isFinite(i)?t===i?[t,t+1]:[t,i]:[0,1]}},{key:"cellRectAt",value:function cellRectAt(e){var t=this.coord,i=this.series.points[e];if(!t||!i)return null;var r=t.xScale.bandStart(i.xValue,void 0),n=void 0===i.name?i.index:i.name,a=t.yScale.bandStart(n,void 0);if(!isFinite(r)||!isFinite(a))return null;var o=t.xScale.bandwidth()||.8*t.xScale.step(),s=t.yScale.bandwidth()||.8*t.yScale.step(),l=t.xScale.range[1]>=t.xScale.range[0]?1:-1,h=t.yScale.range[1]>=t.yScale.range[0]?1:-1,u=Math.max(1,o),c=Math.max(1,s);return{x:l>0?r:r-u,y:h>0?a:a-c,width:u,height:c}}},{key:"doRender",value:function doRender(){var e=this.coord;if(e){var t=this.ctx,i=_slicedToArray(this.valueRange(),2),r=i[0],n=i[1],a=this.series.option.heatmap||{},o=a.minColor||"#EFF6FF",s=a.maxColor||this.series.color,l=this.isEntering();this.computeItemProgress();var h=e.xScale.domain.length||1;this.beginDraw();for(var u=0;u<this.series.points.length;u++){var c=this.series.points[u],d=this.cellRectAt(u);if(d){var f=null===c.y?0:(c.y-r)/(n-r||1),p=1;if(l){var v=(u%h+Math.floor(u/h))%Math.max(1,h)/Math.max(1,h),m=this.progress();if((p=Math.max(0,Math.min(1,(m-v*(this.stagger||.35))/Math.max(.05,1-v*(this.stagger||.35)))))<=0)continue;t.globalAlpha=p}t.fillStyle=mixColors(o,s,Math.max(0,Math.min(1,f))),t.fillRect(d.x,d.y,d.width,d.height),l&&(t.globalAlpha=1)}}null!==this.hoverIndex&&this.drawHoverOverlay(this.hoverIndex,this.cellRectAt(this.hoverIndex),{radius:0}),this.endDraw()}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){for(var i=0;i<this.series.points.length;i++){var r=this.cellRectAt(i);if(r&&(e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height))return i}return-1}},{key:"paintPad",value:function paintPad(){return 4}}])}();function mixColors(e,t,i){var r=parseHex$1(e),n=parseHex$1(t);if(!r||!n)return t;var a=Math.round(r[0]+(n[0]-r[0])*i),o=Math.round(r[1]+(n[1]-r[1])*i),s=Math.round(r[2]+(n[2]-r[2])*i);return"rgb(".concat(a,",").concat(o,",").concat(s,")")}function parseHex$1(e){if("string"!=typeof e)return null;var t=e.trim();if(0===t.indexOf("#"))return 3===(t=t.slice(1)).length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?null:[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];var i=t.match(/rgba?\(([^)]+)\)/);if(i){var r=i[1].split(",").map(function(e){return parseFloat(e)});return[r[0]||0,r[1]||0,r[2]||0]}return null}function layoutSankey(e,i,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{nodes:[],links:[]},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t,o=e.length;if(!o)return{nodes:[],links:[]};var s,l=Math.max(2,Number(n.nodeWidth)||16),h=Math.max(0,Number(n.nodePadding)||10),u=Math.max(0,void 0===Number(n.iterations)?6:Number(n.iterations)),c=function indexOf(t){return"number"==typeof t?t>=0&&t<o?t:-1:e.findIndex(function(e){return e.name===t})},d=i.map(function(e,t){return{id:t,source:c(e.source),target:c(e.target),value:Math.max(0,Number(e.value)||0),color:e.color}}).filter(function(e){return e.source>=0&&e.target>=0&&e.value>0}),f=e.map(function(){return[]}),p=e.map(function(){return[]}),v=new Array(o).fill(0),m=_createForOfIteratorHelper(d);try{for(m.s();!(s=m.n()).done;){var g=s.value;f[g.source].push(g.target),p[g.target].push(g.source),v[g.target]++}}catch(e){m.e(e)}finally{m.f()}for(var b=new Array(o).fill(0),k=[],S=0;S<o;S++)0===v[S]&&k.push(S);for(;k.length;){var w,A=k.shift(),_=_createForOfIteratorHelper(f[A]);try{for(_.s();!(w=_.n()).done;){var M=w.value;b[M]=Math.max(b[M],b[A]+1),0===--v[M]&&k.push(M)}}catch(e){_.e(e)}finally{_.f()}}for(var C=0;C<o;C++)void 0!==e[C].depth&&(b[C]=Math.max(0,Number(e[C].depth)||0));var T,P=Math.max.apply(Math,[1].concat(_toConsumableArray(b))),I=function columnX(e){return r.x+e*(r.width-l)/P},O=new Array(o).fill(0),N=new Array(o).fill(0),D=_createForOfIteratorHelper(d);try{for(D.s();!(T=D.n()).done;){var H=T.value;N[H.source]+=H.value,O[H.target]+=H.value}}catch(e){D.e(e)}finally{D.f()}for(var R=new Array(o).fill(0).map(function(e,t){return Math.max(O[t],N[t])}),E=new Array(P+1).fill(0),L=0;L<o;L++){E[b[L]]+=R[L]}for(var z=new Array(P+1).fill(0),B=0;B<o;B++)z[b[B]]++;var W,V=E.map(function(e,t){var i=r.height-h*Math.max(0,z[t]-1);return e>0?Math.max(1,i)/e:1}),j=e.map(function(e,t){var i=Math.max(2,R[t]*V[b[t]]);return{id:t,name:e.name,depth:b[t],x:I(b[t]),y:r.y,width:l,height:i,value:R[t],color:e.color||a[t%a.length]}}),U=new Array(P+1).fill(0).map(function(){return[]}),X=_createForOfIteratorHelper(j);try{for(X.s();!(W=X.n()).done;){var K=W.value;U[K.depth].push(K.id)}}catch(e){X.e(e)}finally{X.f()}var G,Y=_createForOfIteratorHelper(U);try{for(Y.s();!(G=Y.n()).done;){var q,$=G.value,Z=r.y,J=_createForOfIteratorHelper($);try{for(J.s();!(q=J.n()).done;){var Q=q.value;j[Q].y=Z,Z+=j[Q].height+h}}catch(e){J.e(e)}finally{J.f()}}}catch(e){Y.e(e)}finally{Y.f()}for(var ee=0;ee<u;ee++){var te,ie=_createForOfIteratorHelper(j);try{for(ie.s();!(te=ie.n()).done;){var re,ne=te.value,ae=[],oe=_createForOfIteratorHelper(d);try{for(oe.s();!(re=oe.n()).done;){var se=re.value;se.source===ne.id?ae.push({id:se.target,weight:se.value}):se.target===ne.id&&ae.push({id:se.source,weight:se.value})}}catch(e){oe.e(e)}finally{oe.f()}if(ae.length){for(var le=0,he=0,ue=0,ce=ae;ue<ce.length;ue++){var de=ce[ue],fe=j[de.id];he+=(fe.y+fe.height/2)*de.weight,le+=de.weight}var pe=le>0?he/le:ne.y+ne.height/2;ne.y=pe-ne.height/2}}}catch(e){ie.e(e)}finally{ie.f()}var ve,ye=_createForOfIteratorHelper(U);try{for(ye.s();!(ve=ye.n()).done;){var me=ve.value;me.sort(function(e,t){return j[e].y-j[t].y});var xe,ge=r.y,be=_createForOfIteratorHelper(me);try{for(be.s();!(xe=be.n()).done;){var ke=xe.value;j[ke].y=ge,ge+=j[ke].height+h}}catch(e){be.e(e)}finally{be.f()}}}catch(e){ye.e(e)}finally{ye.f()}}var Se,we=_createForOfIteratorHelper(U);try{for(we.s();!(Se=we.n()).done;){var Ae=Se.value,_e=Ae.length?j[Ae[Ae.length-1]].y+j[Ae[Ae.length-1]].height-(r.y+r.height):0;if(_e>0){var Me,Ce=_createForOfIteratorHelper(Ae);try{for(Ce.s();!(Me=Ce.n()).done;){var Te=Me.value;j[Te].y=Math.max(r.y,j[Te].y-_e)}}catch(e){Ce.e(e)}finally{Ce.f()}}}}catch(e){we.e(e)}finally{we.f()}var Pe,Fe=new Array(o).fill(0),Ie=new Array(o).fill(0),Oe=[],Ne=_createForOfIteratorHelper(d.slice().sort(function(e,t){return e.source-t.source||e.target-t.target}));try{for(Ne.s();!(Pe=Ne.n()).done;){var De=Pe.value,He=j[De.source],Re=j[De.target],Ee=He.value>0?He.height/He.value:0,Le=Re.value>0?Re.height/Re.value:0,ze=Math.max(1,De.value*Math.min(Ee,Le)),Be=He.y+Fe[De.source],We=Re.y+Ie[De.target];Fe[De.source]+=ze,Ie[De.target]+=ze,Oe.push({id:De.id,source:De.source,target:De.target,value:De.value,width:ze,sy:Be,ty:We,color:De.color||He.color})}}catch(e){Ne.e(e)}finally{Ne.f()}return{nodes:j,links:Oe}}function sampleLinkPath(e,t,i){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:16,a=[],o=e.sy+e.width/2-r,s=e.ty+e.width/2-r,l=t+.5*(i-t),h=i-.5*(i-t),u=0;u<=n;u++){var c=u/n,d=1-c,f=d*d*d*t+3*d*d*c*l+3*d*c*c*h+c*c*c*i,p=d*d*d*o+3*d*d*c*o+3*d*c*c*s+c*c*c*s;a.push([f,p])}return a}var re=function(){function SankeySeries(){var e;_classCallCheck(this,SankeySeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,SankeySeries,[].concat(i)),"seriesType","sankey"),_defineProperty(e,"sankey",null),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"sankeyCacheKey",""),e}return _inherits(SankeySeries,G),_createClass(SankeySeries,[{key:"setCoord",value:function setCoord(e){return this.sankey=e||null,this.sankeyCacheKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 24}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.sankey;if(e){var t=e.layout,i=t.nodes,r=t.links,n=i.length+r.length,a=[e.plot.x,e.plot.y],o=a[0],s=a[1],l=this.buildSeriesKey([n,o,s,e.plot.width,e.plot.height,i.length,r.length]);if(l!==this.sankeyCacheKey||this.pixels.length!==2*n){this.sankeyCacheKey=l,this.pixels=new Float64Array(2*n);var h,u=_createForOfIteratorHelper(i);try{for(u.s();!(h=u.n()).done;){var c=h.value;this.pixels[2*c.id]=c.x-o+c.width/2,this.pixels[2*c.id+1]=c.y-s+c.height/2}}catch(e){u.e(e)}finally{u.f()}var d,f=_createForOfIteratorHelper(r);try{for(f.s();!(d=f.n()).done;){var p=d.value,v=i[p.source],m=i[p.target];if(v&&m){var g=i.length+p.id;this.pixels[2*g]=(v.x+v.width+m.x)/2-o,this.pixels[2*g+1]=(p.sy+p.ty)/2+p.width/2-s}}}catch(e){f.e(e)}finally{f.f()}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"doRender",value:function doRender(){var e=this.sankey;if(e){var t=e.layout,i=t.nodes,r=t.links,n=this.ctx,a=e.plot,o=this.unit();this.beginDraw();var s=e.options.flow;s?this.keepAnimating():this.stopAnimating();var l=Number(e.options.linkOpacity);n.globalAlpha=isFinite(l)?Math.max(0,Math.min(1,l)):.42;var h,u=_createForOfIteratorHelper(r);try{for(u.s();!(h=u.n()).done;){var c=h.value,d=i[c.source],f=i[c.target];if(d&&f){var p=d.x-a.x+d.width,v=f.x-a.x,m=c.sy-a.y,g=c.ty-a.y,b=p+.5*(v-p),k=v-.5*(v-p);if(n.beginPath(),n.moveTo(p,m),n.bezierCurveTo(b,m,k,g,v,g),n.lineTo(v,g+c.width),n.bezierCurveTo(k,g+c.width,b,m+c.width,p,m+c.width),n.closePath(),n.fillStyle=c.color,n.fill(),s){var S=Number(e.options.flowSpeed)||40;if(n.save(),n.globalAlpha=.9,n.beginPath(),n.moveTo(p,(m+g)/2),n.bezierCurveTo(b,(m+g)/2,k,(m+g)/2,v,(m+g)/2),n.strokeStyle="#ffffff",n.lineWidth=Math.max(o,Math.min(5*o,.28*c.width)),"function"==typeof n.setLineDash){var w=[6*o,10*o];n.setLineDash(w),"number"==typeof n.lineDashOffset&&(n.lineDashOffset=-Date.now()/1e3*S%(w[0]+w[1]))}n.stroke(),"function"==typeof n.setLineDash&&n.setLineDash([]),n.restore()}}}}catch(e){u.e(e)}finally{u.f()}n.globalAlpha=1;var A,_=_createForOfIteratorHelper(i);try{for(_.s();!(A=_.n()).done;){var M=A.value;n.beginPath();var C=M.x-a.x,T=M.y-a.y,P=Math.min(3,M.width/2);n.moveTo(C+P,T),n.lineTo(C+M.width-P,T),n.arcTo(C+M.width,T,C+M.width,T+P,P),n.lineTo(C+M.width,T+M.height-P),n.arcTo(C+M.width,T+M.height,C+M.width-P,T+M.height,P),n.lineTo(C+P,T+M.height),n.arcTo(C,T+M.height,C,T+M.height-P,P),n.lineTo(C,T+P),n.arcTo(C,T,C+P,T,P),n.closePath(),n.fillStyle=M.color,n.fill(),n.strokeStyle="rgba(255,255,255,0.75)",n.lineWidth=o,n.stroke()}}catch(e){_.e(e)}finally{_.f()}if(!e.options.label||!1!==e.options.label.show){var I=this.chartTheme;if(I){this.setFont(I.fontSize,I.fontFamily),n.fillStyle=I.textColor,n.textBaseline="middle";var O,N=Math.max.apply(Math,_toConsumableArray(i.map(function(e){return e.depth})).concat([0])),D=_createForOfIteratorHelper(i);try{for(D.s();!(O=D.n()).done;){var H=O.value,R=H.x-a.x,E=H.y-a.y+H.height/2;H.depth>=N?(n.textAlign="right",this.fillLabelWithHalo(H.name,R-6*o,E)):(n.textAlign="left",this.fillLabelWithHalo(H.name,R+H.width+6*o,E))}}catch(e){D.e(e)}finally{D.f()}}}this.endDraw()}}},{key:"fillLabelWithHalo",value:function fillLabelWithHalo(e,t,i){var r=this.ctx,n=this.chartTheme;r.lineWidth=3*this.unit(),r.strokeStyle=n&&n.labelHaloColor||"rgba(255,255,255,0.85)",r.lineJoin="round",r.strokeText(e,t,i),r.fillStyle=n&&n.textColor||"#212529",r.fillText(e,t,i)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.sankey;if(!i)return-1;var r,n=i.layout,a=n.nodes,o=n.links,s=i.plot,l=_createForOfIteratorHelper(a);try{for(l.s();!(r=l.n()).done;){var h=r.value,u=h.x-s.x,c=h.y-s.y;if(e>=u-2&&e<=u+h.width+2&&t>=c-2&&t<=c+h.height+2)return h.id}}catch(e){l.e(e)}finally{l.f()}var d,f=_createForOfIteratorHelper(o);try{for(f.s();!(d=f.n()).done;){var p=d.value,v=a[p.source],m=a[p.target];if(v&&m)for(var g=sampleLinkPath(p,v.x-s.x+v.width,m.x-s.x,s.y,12),b=1;b<g.length;b++){if(distanceToSegment(e,t,g[b-1][0],g[b-1][1],g[b][0],g[b][1])<=6)return a.length+p.id}}}catch(e){f.e(e)}finally{f.f()}return-1}}])}(),ne=function(){function FunnelSeries(){var e;_classCallCheck(this,FunnelSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,FunnelSeries,[].concat(i)),"seriesType","funnel"),_defineProperty(e,"funnel",null),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"stageGeom",[]),_defineProperty(e,"stageRects",[]),_defineProperty(e,"funnelKey",""),_defineProperty(e,"stageFrom",null),e}return _inherits(FunnelSeries,G),_createClass(FunnelSeries,[{key:"setHiddenSlices",value:function setHiddenSlices(e){return e.join(",")!==this.hiddenSlices.join(",")&&this.stageGeom.length&&(this.stageFrom=this.stageGeom.map(function(e){return e?_objectSpread2({},e):null})),_superPropGet(FunnelSeries,"setHiddenSlices",this,3)([e]),this.funnelKey="",this}},{key:"setCoord",value:function setCoord(e){return this.funnel=e||null,this.funnelKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 12}},{key:"highlightRectAt",value:function highlightRectAt(e){return this.rebuildPixels(),this.stageRects[e]||null}},{key:"widthAt",value:function widthAt(e,t){var i=e.y1-e.y0||1,r=Math.max(0,Math.min(1,(t-e.y0)/i));return e.topWidth+(e.bottomWidth-e.topWidth)*r}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.funnel,t=this.series.points,i=t.length;if(!e||!i)return this.pixels=new Float64Array(0),this.stageGeom=[],void(this.stageRects=[]);var r=e.options||{},n=this.buildSeriesKey([i,e.plot.width,e.plot.height,r.sort,r.minSize,r.trapezoid,this.hiddenSlices.join(",")]);if(n!==this.funnelKey||this.pixels.length!==2*i){this.funnelKey=n,this.pixels.length!==2*i&&(this.pixels=new Float64Array(2*i)),this.stageGeom=new Array(i).fill(null),this.stageRects=new Array(i).fill(null);for(var a=[],o=0;o<i;o++)this.hiddenSlices.indexOf(o)>=0||null!==t[o].y&&a.push(o);var s=r.sort||"descending";if("none"!==s&&a.sort(function(e,i){return"ascending"===s?(t[e].y||0)-(t[i].y||0):(t[i].y||0)-(t[e].y||0)}),a.length){for(var l=Math.max(0,Number(r.gap)||2),h=Math.max(4,(e.plot.height-l*(a.length-1))/a.length),u=Math.max.apply(Math,_toConsumableArray(a.map(function(e){return t[e].y||0})).concat([0])),c=Math.max(0,Math.min(1,void 0===r.minSize?.12:Number(r.minSize))),d=e.plot.width,f=e.plot.width/2,p=this.isEntering()?Math.max(0,Math.min(1,this.progress())):1,v=.72*d,m=a.map(function(e){var i=t[e].y||0,r=u>0?i/u:1,n=Math.max(d*c,d*Math.max(0,Math.min(1,r)));return v+(n-v)*p}),g=!1!==r.trapezoid,b=0;b<a.length;b++){var k=a[b],S=b*(h+l),w=S+h,A=m[b],_=g&&b+1<m.length?m[b+1]:m[b],M={y0:S,y1:w,topWidth:A,bottomWidth:_,cx:f};this.stageGeom[k]=M;var C=Math.max(A,_)/2;this.stageRects[k]={x:f-C,y:S,width:2*C,height:w-S},this.pixels[2*k]=f,this.pixels[2*k+1]=(S+w)/2}this.blendStageMorph(),this.xMonotonic=!1,this.renderIndices=null}}}},{key:"blendStageMorph",value:function blendStageMorph(){var e=this.stageFrom;if(e&&!this.isEntering()){var t=Math.max(0,Math.min(1,this.progress()));if(t>=1)this.stageFrom=null;else for(var i=0;i<this.stageGeom.length;i++){var r=this.stageGeom[i],n=e[i];if(r&&n){var a=function lerp(e,i){return e+(i-e)*t};r.y0=a(n.y0,r.y0),r.y1=a(n.y1,r.y1),r.topWidth=a(n.topWidth,r.topWidth),r.bottomWidth=a(n.bottomWidth,r.bottomWidth);var o=Math.max(r.topWidth,r.bottomWidth)/2;this.stageRects[i]={x:r.cx-o,y:r.y0,width:2*o,height:r.y1-r.y0},this.pixels[2*i]=r.cx,this.pixels[2*i+1]=(r.y0+r.y1)/2}}}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();for(var i=0;i<this.stageGeom.length;i++){var r=this.stageGeom[i];if(r&&!(t<r.y0-1||t>r.y1+1)){var n=this.widthAt(r,t)/2*this.hoverBoost(i,.06)+1;if(Math.abs(e-r.cx)<=n)return i}}return-1}},{key:"doRender",value:function doRender(){var e=this.funnel;if(e&&this.chartTheme){this.rebuildPixels();for(var t=this.ctx,i=this.unit(),r=this.chartTheme,n=(e.options||{}).labelPosition||"inside",a=0,o=0;o<this.stageGeom.length;o++)this.stageGeom[o]&&a++;for(var s=0,l=0;l<this.series.points.length;l++)this.stageGeom[l]&&(s+=this.series.points[l].y||0);this.beginDraw();for(var h=0;h<this.stageGeom.length;h++){var u=this.stageGeom[h];if(u){var c=this.series.points[h].color||this.series.color,d=this.hoverBoost(h,.06),f=u.topWidth*d,p=u.bottomWidth*d;t.beginPath(),t.moveTo(u.cx-f/2,u.y0),t.lineTo(u.cx+f/2,u.y0),t.lineTo(u.cx+p/2,u.y1),t.lineTo(u.cx-p/2,u.y1),t.closePath();var v=t.createLinearGradient(0,u.y0,0,u.y1);v.addColorStop(0,hexToRgba(c,.95)),v.addColorStop(1,hexToRgba(c,.75)),t.fillStyle=v,t.fill(),t.strokeStyle="rgba(255,255,255,0.7)",t.lineWidth=i,t.stroke()}}this.setFont(r.fontSize,r.fontFamily),t.textBaseline="middle";for(var m=0;m<this.stageGeom.length;m++){var g=this.stageGeom[m];if(g){var b=this.series.points[m],k=b.y||0,S=s>0?k/s*100:0,w="".concat(b.name||b.xValue," ").concat(k).concat(a>1?" ".concat(S.toFixed(1),"%"):""),A=(g.y0+g.y1)/2,_=this.widthAt(g,A);if("right"!==n)measureTextWidth(t,w,r.fontSize,r.fontFamily)+12>_?(t.textAlign="left",t.fillStyle=r.textColor,t.fillText(w,g.cx+Math.max(g.topWidth,g.bottomWidth)/2+8*i,A)):(t.textAlign="center",t.fillStyle="#ffffff",t.fillText(w,g.cx,A));else t.textAlign="left",t.fillStyle=r.textColor,t.fillText(w,g.cx+Math.max(g.topWidth,g.bottomWidth)/2+8*i,A)}}this.endDraw()}}}])}(),ae=2*Math.PI,oe=Math.PI/180,se=function(){function GaugeSeries(){var e;_classCallCheck(this,GaugeSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,GaugeSeries,[].concat(i)),"seriesType","gauge"),_defineProperty(e,"gauge",null),_defineProperty(e,"gaugeKey",""),_defineProperty(e,"fromValue",null),e}return _inherits(GaugeSeries,G),_createClass(GaugeSeries,[{key:"setCoord",value:function setCoord(e){return this.gauge=e||null,this.gaugeKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 8}},{key:"updateSeries",value:function updateSeries(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t&&this.gauge&&(this.fromValue=this.renderedValue()),_superPropGet(GaugeSeries,"updateSeries",this,3)([e,t,i])}},{key:"renderedValue",value:function renderedValue(){var e=this.range().min,t=this.series.points.length&&Number(this.series.points[0].y)||0,i=Math.max(0,Math.min(1,this.progress())),r=null===this.fromValue?e:this.fromValue;return r+(t-r)*i}},{key:"angles",value:function angles(){for(var e=this.gauge&&this.gauge.options||{},t=void 0===e.startAngle?225:Number(e.startAngle),i=void 0===e.endAngle?-45:Number(e.endAngle),r=-t*oe,n=-i*oe;n<=r;)n+=ae;return{a0:r,a1:n,sweep:n-r}}},{key:"range",value:function range(){var e=this.gauge&&this.gauge.options||{},t=isFinite(Number(e.min))?Number(e.min):0,i=isFinite(Number(e.max))?Number(e.max):100;return{min:t,max:i>t?i:t+1}}},{key:"angleFor",value:function angleFor(e){var t=this.angles(),i=t.a0,r=t.sweep,n=this.range(),a=n.min,o=n.max;return i+Math.max(0,Math.min(1,(e-a)/(o-a)))*r}},{key:"localCenter",value:function localCenter(){var e=this.gauge;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.gauge;if(e){var t=e.options||{},i=this.series.points.length&&Number(this.series.points[0].y)||0,r=this.buildSeriesKey([e.polar.radius,t.startAngle,t.endAngle,t.min,t.max,i]);if(r!==this.gaugeKey||2!==this.pixels.length){this.gaugeKey=r,2!==this.pixels.length&&(this.pixels=new Float64Array(2));var n=_slicedToArray(this.localCenter(),2),a=n[0],o=n[1],s=Number(t.pointer&&t.pointer.length||.72)*e.polar.radius,l=this.angleFor(i);this.pixels[0]=a+Math.cos(l)*s,this.pixels[1]=o+Math.sin(l)*s,this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.gauge;if(!i||!this.series.points.length)return-1;var r=_slicedToArray(this.localCenter(),2),n=r[0],a=r[1];return Math.hypot(e-n,t-a)<=i.polar.radius+12?0:-1}},{key:"doRender",value:function doRender(){var e=this.gauge;if(e&&this.chartTheme){this.rebuildPixels();var t=this.ctx,i=this.chartTheme,r=e.options||{},n=this.unit(),a=_slicedToArray(this.localCenter(),2),o=a[0],s=a[1],l=e.polar.radius,h=this.angles(),u=h.a0,c=h.sweep,d=this.range(),f=d.min,p=d.max,v=Math.max(2,Number(r.lineWidth)||14),m=this.renderedValue();this.beginDraw();for(var g=r.axisLineColor&&r.axisLineColor.length?r.axisLineColor:[[1,i.colorPalette[0]]],b=0,k=0;k<g.length;k++){var S=_slicedToArray(g[k],2),w=S[0],A=S[1],_=b,M=Math.max(b,Math.min(1,Number(w)));b=M,M<=_||(t.beginPath(),t.arc(o,s,l,u+_*c,u+M*c),t.strokeStyle=A,t.lineWidth=v,t.lineCap="butt",t.stroke())}var C=Math.max(1,Number(r.splitNumber)||5);this.setFont(.85*i.fontSize,i.fontFamily),t.fillStyle=i.subTextColor,t.textBaseline="middle",t.textAlign="center";for(var T=0;T<=C;T++){var P=T/C,I=u+P*c,O=l-v-2*n,N=l-v-8*n;t.beginPath(),t.moveTo(o+Math.cos(I)*O,s+Math.sin(I)*O),t.lineTo(o+Math.cos(I)*N,s+Math.sin(I)*N),t.strokeStyle=i.axisLineColor,t.lineWidth=n,t.stroke();var D=l-v-20*n;t.fillText(String(Math.round(f+P*(p-f))),o+Math.cos(I)*D,s+Math.sin(I)*D)}var H=r.pointer||{};if(!1!==H.show){var R=Math.max(.1,Number(H.length)||.72)*l,E=Math.max(1,Number(H.width)||5)*n,L=this.angleFor(m),z=o+Math.cos(L)*R,B=s+Math.sin(L)*R,W=o+Math.cos(L+Math.PI/2)*E,V=s+Math.sin(L+Math.PI/2)*E,j=o+Math.cos(L-Math.PI/2)*E,U=s+Math.sin(L-Math.PI/2)*E;t.beginPath(),t.moveTo(z,B),t.lineTo(W,V),t.lineTo(j,U),t.closePath(),t.fillStyle=i.textColor,t.fill(),t.beginPath(),t.arc(o,s,1.6*E,0,ae),t.fillStyle=i.textColor,t.fill(),t.beginPath(),t.arc(o,s,.7*E,0,ae),t.fillStyle="#ffffff",t.fill()}var X=r.detail||{},K=X.formatter?String(X.formatter(m)):"".concat(Math.round(100*m)/100),G=Math.max(0,360-this.angles().sweep/oe)>20;if(!1!==X.show){var Y=Number(X.fontSize)||Math.max(16,Math.round(.26*l));this.setFont(Y,i.fontFamily,"bold"),t.textAlign="center",t.textBaseline="middle",t.fillStyle=i.textColor,t.fillText(K,o,s+l*(G?.78:.42))}var q=r.title||{},$=this.series.points[0],Z=$&&($.name||void 0!==$.xValue)?$.name||String($.xValue):"";if(!1!==q.show&&Z){var J=Number(q.fontSize)||i.fontSize;this.setFont(J,i.fontFamily),measureTextWidth(t,Z,J,i.fontFamily),t.textAlign="center",t.textBaseline="middle",t.fillStyle=i.subTextColor,t.fillText(Z,o,s+l*(G?.6:.68))}this.endDraw()}}}])}(),le=function(){function BoxplotSeries(){var e;_classCallCheck(this,BoxplotSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,BoxplotSeries,[].concat(i)),"seriesType","boxplot"),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"boxCacheKey",""),e}return _inherits(BoxplotSeries,G),_createClass(BoxplotSeries,[{key:"boxWidthAt",value:function boxWidthAt(e){var t=Number(this.series.option.barWidth);return!isFinite(t)||t<=0?Math.max(4,.5*e):t<=1?Math.max(4,e*t):Math.max(4,t*this.unit())}},{key:"boxRectAt",value:function boxRectAt(e){var t=this.coord,i=this.series.points[e];if(!t||!i||!i.boxplot)return null;var r=t.xScale.map(i.xValue);if(!isFinite(r))return null;var n=t.xScale.bandwidth()||.5*t.xScale.step(),a=this.boxWidthAt(n),o=_slicedToArray(i.boxplot,4),s=o[1],l=o[3],h=_slicedToArray(i.boxplot,5),u=h[0],c=h[4],d=t.yScale.map(s),f=t.yScale.map(l),p=t.yScale.map(u),v=t.yScale.map(c);return isFinite(d)&&isFinite(f)&&isFinite(p)&&isFinite(v)?{x:r-a/2,y:Math.min(d,f),width:a,height:Math.max(Math.abs(f-d),this.unit())}:null}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord,t=this.series.points.length;if(e){var i=this.buildSeriesKey([t,e.plot.width,e.plot.height,String(e.xScale.domain.join(","))]);if(i!==this.boxCacheKey||this.pixels.length!==2*t){this.boxCacheKey=i,this.pixels.length!==2*t&&(this.pixels=new Float64Array(2*t));for(var r=0;r<t;r++){var n=this.boxRectAt(r),a=this.series.points[r];n&&a&&a.boxplot?(this.pixels[2*r]=n.x+n.width/2,this.pixels[2*r+1]=e.yScale.map(a.boxplot[2])):(this.pixels[2*r]=NaN,this.pixels[2*r+1]=NaN)}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var i=this.coord;if(!i)return-1;for(var r=0;r<this.series.points.length;r++){var n=this.series.points[r],a=this.boxRectAt(r);if(n&&n.boxplot&&a){var o=a.x+a.width/2;if(!(Math.abs(e-o)>a.width/2+1)){var s=i.yScale.map(n.boxplot[0]),l=i.yScale.map(n.boxplot[4]),h=Math.min(s,l),u=Math.max(s,l);if(t>=h-2&&t<=u+2)return r}}}return-1}},{key:"doRender",value:function doRender(){var e=this,t=this.coord;if(t&&this.chartTheme){this.rebuildPixels();var i=this.ctx;this.chartTheme;var r=this.unit(),n=this.pointColor(0),a=this.isEntering();this.computeItemProgress(),this.beginDraw();for(var o=function _loop(){var o=e.series.points[s],l=e.boxRectAt(s);if(!o||!o.boxplot||!l)return 0;var h=_slicedToArray(o.boxplot,5),u=h[0],c=h[1],d=h[2],f=h[3],p=h[4],v=l.x+l.width/2,m=t.yScale.map(d),g=a?e.itemProgress[s]:1;if(g<=0)return 0;var b=function lerp(e){return m+(e-m)*g},k=b(t.yScale.map(u)),S=b(t.yScale.map(p)),w=b(t.yScale.map(f)),A=b(t.yScale.map(c)),_={x:l.x,y:Math.min(w,A),width:l.width,height:Math.max(Math.abs(A-w),e.unit())};i.beginPath(),i.moveTo(v,S),i.lineTo(v,_.y),i.moveTo(v,_.y+_.height),i.lineTo(v,k),i.strokeStyle=n,i.lineWidth=r,i.stroke(),i.beginPath(),i.moveTo(v-l.width/4,S),i.lineTo(v+l.width/4,S),i.moveTo(v-l.width/4,k),i.lineTo(v+l.width/4,k),i.stroke(),i.beginPath(),i.rect(_.x,_.y,_.width,_.height),i.fillStyle=function hexWithAlpha(e,t){if(!e)return"rgba(0,0,0,".concat(t,")");var i=e.replace("#","");3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]);if(6!==i.length)return e;var r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return"rgba(".concat(r,",").concat(n,",").concat(a,",").concat(t,")")}(n,.28),i.fill(),i.strokeStyle=n,i.lineWidth=r,i.stroke(),i.beginPath(),i.moveTo(_.x,m),i.lineTo(_.x+_.width,m),i.lineWidth=Math.max(r,2*r),i.stroke(),e.drawHoverOverlay(s,_,{radius:1})},s=0;s<this.series.points.length;s++)o();this.endDraw()}}}])}();var he=function(){function WaterfallSeries(){var e;_classCallCheck(this,WaterfallSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,WaterfallSeries,[].concat(i)),"seriesType","waterfall"),e}return _inherits(WaterfallSeries,q),_createClass(WaterfallSeries,[{key:"isTotalItem",value:function isTotalItem(e){var t=this.series.points[e]&&this.series.points[e].raw;return!(!t||"object"!==_typeof(t)||Array.isArray(t)||!t.total)}},{key:"isIncrease",value:function isIncrease(e){var t=this.series.points[e];return!t||(t.y||0)>=0}},{key:"barColorAt",value:function barColorAt(e){var i=waterfallOptionOf(this.series),r=this.chartTheme,n=r&&r.colorPalette||t;return this.isTotalItem(e)?i.totalColor||n[0]:this.isIncrease(e)?i.increaseColor||n[1]:i.decreaseColor||n[2]}},{key:"doRender",value:function doRender(){if(_superPropGet(WaterfallSeries,"doRender",this,3)([]),!1!==waterfallOptionOf(this.series).connector){var e=this.coord;if(e){var t=this.ctx,i=this.unit(),r=this.chartTheme,n=e.yScale.isBand&&e.yScale.isBand();t.save(),t.strokeStyle=r&&r.subTextColor||"#6C757D",t.lineWidth=i,"function"==typeof t.setLineDash&&t.setLineDash([4*i,3*i]),t.beginPath();for(var a=0;a<this.series.points.length-1;a++){var o=this.barRectAt(a),s=this.barRectAt(a+1);if(o&&s)if(n){var l=Math.max(o.x+o.width,s.x+s.width),h=o.y+o.height/2,u=s.y+s.height/2;t.moveTo(l,h),t.lineTo(l,u)}else{var c=Math.min(o.y,s.y),d=o.x+o.width/2,f=s.x+s.width/2;t.moveTo(d,c),t.lineTo(f,c)}}t.stroke(),"function"==typeof t.setLineDash&&t.setLineDash([]),t.restore()}}}}])}();function waterfallOptionOf(e){return e&&e.waterfallOption?e.waterfallOption:e&&e.option&&e.option.waterfall||{}}var ue=function(){function TreemapSeries(){var e;_classCallCheck(this,TreemapSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,TreemapSeries,[].concat(i)),"seriesType","treemap"),_defineProperty(e,"treemap",null),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"treemapKey",""),_defineProperty(e,"morphFrom",{}),_defineProperty(e,"morphing",!1),_defineProperty(e,"rectCache",new Map),e}return _inherits(TreemapSeries,G),_createClass(TreemapSeries,[{key:"updateSeries",value:function updateSeries(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t&&this.treemap){var r,n={},a=_createForOfIteratorHelper(this.treemap.layout);try{for(a.s();!(r=a.n()).done;){var o=r.value;n["".concat(o.depth,":").concat(o.name)]=_objectSpread2({},o.rect)}}catch(e){a.e(e)}finally{a.f()}this.morphFrom=n,this.morphing=!0}return _superPropGet(TreemapSeries,"updateSeries",this,3)([e,t,i])}},{key:"rectOf",value:function rectOf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.rectCache,i=this.progress();if(!this.morphing)return e.rect;if(i>=1)return this.morphing=!1,e.rect;var r=t.get(e.id);if(r)return r;var n,a=this.treemap?this.treemap.layout:[],o=this.morphFrom["".concat(e.depth,":").concat(e.name)],s=e.parent>=0?a[e.parent]:null,l=s?this.morphFrom["".concat(s.depth,":").concat(s.name)]:null;if(s&&o&&l&&l.width>1&&l.height>1){var h=this.rectOf(s,t),u=(o.x-l.x)/l.width,c=(o.y-l.y)/l.height,d=o.width/l.width,f=o.height/l.height;n={x:h.x+u*h.width,y:h.y+c*h.height,width:d*h.width,height:f*h.height}}else n=o?{x:o.x+(e.rect.x-o.x)*i,y:o.y+(e.rect.y-o.y)*i,width:o.width+(e.rect.width-o.width)*i,height:o.height+(e.rect.height-o.height)*i}:e.rect;return t.set(e.id,n),n}},{key:"setCoord",value:function setCoord(e){return this.treemap=e||null,this.treemapKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 6}},{key:"highlightRectAt",value:function highlightRectAt(e){var t=this.treemap;if(!t)return null;var i=t.layout[e];if(!i)return null;var r=this.rectOf(i);return{x:r.x-t.plot.x,y:r.y-t.plot.y,width:r.width,height:r.height}}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.treemap,t=e&&e.layout||[];if(e&&t.length){var i=this.buildSeriesKey([t.length,e.plot.width,e.plot.height]);if(i!==this.treemapKey||this.pixels.length!==2*t.length){this.treemapKey=i,this.pixels=new Float64Array(2*t.length);var r,n=_createForOfIteratorHelper(t);try{for(n.s();!(r=n.n()).done;){var a=r.value,o=this.rectOf(a);this.pixels[2*a.id]=o.x-e.plot.x+o.width/2,this.pixels[2*a.id+1]=o.y-e.plot.y+o.height/2}}catch(e){n.e(e)}finally{n.f()}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.treemap;if(!i)return-1;var r,n=-1,a=-1,o=_createForOfIteratorHelper(i.layout);try{for(o.s();!(r=o.n()).done;){var s=r.value,l=this.rectOf(s),h=l.x-i.plot.x,u=l.y-i.plot.y;e<h||e>h+l.width||t<u||t>u+l.height||s.depth>a&&(a=s.depth,n=s.id)}}catch(e){o.e(e)}finally{o.f()}return n}},{key:"doRender",value:function doRender(){var e=this,t=this.treemap;if(t&&this.chartTheme){this.rebuildPixels();var i=this.ctx,r=this.chartTheme,n=this.unit(),a=t.plot,o=t.options||{},s=void 0===o.minLabelRatio?.02:Number(o.minLabelRatio);this.rectCache=new Map,this.beginDraw();var l,h=_createForOfIteratorHelper(t.layout);try{for(h.s();!(l=h.n()).done;){var u=l.value,c=this.rectOf(u),d=c.x-a.x,f=c.y-a.y;i.beginPath(),i.rect(d,f,c.width,c.height),i.fillStyle=u.color,i.fill(),0===u.depth&&(i.strokeStyle="rgba(255,255,255,0.9)",i.lineWidth=1.5*n,i.stroke())}}catch(e){h.e(e)}finally{h.f()}if(null!==this.hoverIndex){var p=t.layout[this.hoverIndex];if(p){var v=this.rectOf(p),m={x:v.x-a.x,y:v.y-a.y,width:v.width,height:p.hasChildren&&p.header>0?p.header:v.height};this.drawHoverOverlay(this.hoverIndex,m,{radius:0,fill:"rgba(255,255,255,0.18)"})}}var g=function fitFontSize(e,t){for(var n=r.fontSize;n>9&&!e.every(function(e){return measureTextWidth(i,e,n,r.fontFamily)<=t});)n-=1;return n};this.setFont(r.fontSize,r.fontFamily),i.textAlign="center",i.textBaseline="middle";var b,k=_createForOfIteratorHelper(t.layout);try{var S=function _loop(){var t=b.value;if(t.ratio<s)return 0;var o=e.rectOf(t),l="".concat((100*t.ratio).toFixed(1),"%");if(t.hasChildren&&t.header>0){i.textAlign="left",i.fillStyle=0===t.depth?"#ffffff":r.textColor;var h="".concat(t.name," ").concat(l),u=g([h],o.width-16*n);return(u>9||measureTextWidth(i,h,u,r.fontFamily)<=o.width-16*n)&&(e.setFont(u,r.fontFamily,"bold"),i.fillText(h,o.x-a.x+8*n,o.y-a.y+t.header/2)),0}if(o.width<44||o.height<26)return 0;var c=(o.height>=40?"".concat(t.name,"\n").concat(l):"".concat(t.name," ").concat(l)).split("\n"),d=g(c,o.width-8*n);if(Math.max.apply(Math,_toConsumableArray(c.map(function(e){return measureTextWidth(i,e,d,r.fontFamily)})))>o.width-8*n)return 0;e.setFont(d,r.fontFamily),i.textAlign="center";var f=0===t.depth?"#ffffff":r.textColor;i.fillStyle=f;for(var p=1.35*d,v=o.y-a.y+o.height/2-(c.length-1)*p/2,m=0;m<c.length;m++)i.fillText(c[m],o.x-a.x+o.width/2,v+m*p)};for(k.s();!(b=k.n()).done;)S()}catch(e){k.e(e)}finally{k.f()}this.endDraw()}}}])}();function forceLayout(e,i,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{nodes:[],links:[]},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t,o=e.length;if(!o)return{nodes:[],links:[]};var s,l=n.layout||"force",h=_slicedToArray(Array.isArray(n.symbolSizeRange)?n.symbolSizeRange:[12,48],2),u=h[0],c=h[1],d=function indexOf(t){if("number"==typeof t)return t>=0&&t<o?t:-1;for(var i=0;i<o;i++){var r=e[i];if(r.id===t||r.name===t)return i}return-1},f=i.map(function(e,t){return{id:t,source:d(e.source),target:d(e.target),value:Number(e.value)||1,color:e.color}}).filter(function(e){return e.source>=0&&e.target>=0&&e.source!==e.target}),p=r.x+r.width/2,v=r.y+r.height/2,m=Math.max(10,Math.min(r.width,r.height)/2-c/2-4),g=e.map(function(e,t){if(isFinite(Number(e.x))&&isFinite(Number(e.y)))return{x:clamp(Number(e.x),r.x+2,r.x+r.width-2),y:clamp(Number(e.y),r.y+2,r.y+r.height-2)};var i=t/o*Math.PI*2-Math.PI/2;return{x:p+Math.cos(i)*m*.8,y:v+Math.sin(i)*m*.8}}),b=g.map(function(){return{x:0,y:0}}),k=g.map(function(e){return{x:e.x,y:e.y}}),S=new Array(o).fill(0),w=new Array(o).fill(0),A=_createForOfIteratorHelper(f);try{for(A.s();!(s=A.n()).done;){var _=s.value;S[_.source]++,S[_.target]++,w[_.source]+=_.value,w[_.target]+=_.value}}catch(e){A.e(e)}finally{A.f()}var M=Math.max.apply(Math,[1].concat(_toConsumableArray(w))),C=function sizeOf(t){var i=Number(e[t].value);if(!isFinite(i)||i<=0)return u;var r=Math.sqrt(Math.max(0,Math.min(1,w[t]/M)));return u+(c-u)*r};if("force"===l)for(var T=numberOr(n.repulsion,6e3),P=numberOr(n.edgeLength,70),I=numberOr(n.gravity,.06),O=Math.max(.1,Math.min(.98,numberOr(n.damping,.85))),N=Math.max(1,Math.floor(numberOr(n.iterations,240))),D=Math.max(8,(u+c)/6),H=0;H<N;H++){for(var R=1-H/N,E=0;E<o;E++)if(!e[E].fixed)for(var L=E+1;L<o;L++){var z=g[L].x-g[E].x,B=g[L].y-g[E].y,W=Math.hypot(z,B);W<D&&(z=z||(E%2==0?.5:-.5),B=B||(L%2==0?.5:-.5),W=Math.hypot(z,B));var V=T/(W*W)*R,j=z/W*V,U=B/W*V;b[E].x-=j,b[E].y-=U,e[L].fixed||(b[L].x+=j,b[L].y+=U)}var X,K=_createForOfIteratorHelper(f);try{for(K.s();!(X=K.n()).done;){var G=X.value,Y=g[G.source],q=g[G.target],$=q.x-Y.x,Z=q.y-Y.y,J=Math.max(.01,Math.hypot($,Z)),Q=.06*(J-(P+(G.value>1?Math.min(40,G.value):0)))*R,ee=$/J*Q,te=Z/J*Q;e[G.source].fixed||(b[G.source].x+=ee,b[G.source].y+=te),e[G.target].fixed||(b[G.target].x-=ee,b[G.target].y-=te)}}catch(e){K.e(e)}finally{K.f()}for(var ie=0;ie<o;ie++)e[ie].fixed||(b[ie].x+=(p-g[ie].x)*I*R,b[ie].y+=(v-g[ie].y)*I*R,b[ie].x*=O,b[ie].y*=O,g[ie].x+=b[ie].x,g[ie].y+=b[ie].y)}if("force"===l&&o>1){for(var re=1/0,ne=1/0,ae=-1/0,oe=-1/0,se=0;se<o;se++){var le=C(se)/2;re=Math.min(re,g[se].x-le),ae=Math.max(ae,g[se].x+le),ne=Math.min(ne,g[se].y-le),oe=Math.max(oe,g[se].y+le)}var he=Math.max(1,ae-re),ue=Math.max(1,oe-ne),ce=Math.min(3,Math.min((r.width-16)/he,(r.height-16)/ue));if(isFinite(ce)&&ce>0)for(var de=(re+ae)/2,fe=(ne+oe)/2,pe=0;pe<o;pe++)g[pe].x=p+(g[pe].x-de)*ce,g[pe].y=v+(g[pe].y-fe)*ce}var ve=e.map(function(e,t){var i=C(t)/2,o=clamp(g[t].x,r.x+i,r.x+r.width-i),s=clamp(g[t].y,r.y+i,r.y+r.height-i);return{id:t,name:e.name,x:o,y:s,initialX:k[t].x,initialY:k[t].y,size:C(t),value:w[t],degree:S[t],color:e.color||colorOf(e,n,a,t),category:e.category,fixed:!!e.fixed}}),ye=Math.max.apply(Math,[1].concat(_toConsumableArray(f.map(function(e){return e.value})))),me=f.map(function(e){return{id:e.id,source:e.source,target:e.target,value:e.value,width:1+3*Math.sqrt(e.value/ye),color:e.color||ve[e.source].color}});return{nodes:ve,links:me}}function colorOf(e,t,i,r){if(void 0!==e.category&&Array.isArray(t.categories)){var n=t.categories.find(function(t){return t.name===e.category});if(n&&n.color)return n.color;var a=t.categories.findIndex(function(t){return t.name===e.category});if(a>=0)return i[a%i.length]}return i[r%i.length]}function numberOr(e,t){var i=Number(e);return isFinite(i)?i:t}function clamp(e,t,i){return e<t?t:e>i?i:e}function sampleGraphLink(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:14,n=t[e.source],a=t[e.target],o=[];if(!n||!a)return o;if(!i)return o.push([n.x,n.y],[a.x,a.y]),o;for(var s=(n.x+a.x)/2,l=(n.y+a.y)/2,h=a.x-n.x,u=a.y-n.y,c=Math.max(1,Math.hypot(h,u)),d=Math.min(30,.18*c),f=s-u/c*d,p=l+h/c*d,v=0;v<=r;v++){var m=v/r,g=1-m;o.push([g*g*n.x+2*g*m*f+m*m*a.x,g*g*n.y+2*g*m*p+m*m*a.y])}return o}var ce=function(){function GraphSeries(){var e;_classCallCheck(this,GraphSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,GraphSeries,[].concat(i)),"seriesType","graph"),_defineProperty(e,"graph",null),_defineProperty(e,"clipToBox",!1),_defineProperty(e,"graphKey",""),e}return _inherits(GraphSeries,G),_createClass(GraphSeries,[{key:"setCoord",value:function setCoord(e){return this.graph=e||null,this.graphKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 28}},{key:"nodeCount",get:function get(){return this.graph&&this.graph.layout.nodes.length||0}},{key:"moveNode",value:function moveNode(e,t,i){var r=this.graph;if(!r)return!1;var n=r.layout.nodes[e];if(!n)return!1;var a=r.plot,o=n.size/2;return n.x=Math.max(a.x+o,Math.min(a.x+a.width-o,t+a.x)),n.y=Math.max(a.y+o,Math.min(a.y+a.height-o,i+a.y)),n.fixed=!0,this.graphKey="",this.markDirty(),!0}},{key:"settle",value:function settle(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,t=this.graph;if(t){var i=t.options||{},r=forceLayout(t.layout.nodes.map(function(e,t){return _objectSpread2(_objectSpread2({},i.nodes&&i.nodes[t]||{name:e.name}),{},{x:e.x,y:e.y,fixed:e.fixed})}),i.links||[],t.plot,_objectSpread2(_objectSpread2({},i),{},{layout:"force",iterations:e}),this.chartTheme?this.chartTheme.colorPalette:void 0);t.layout=r,this.graphKey="",this.markDirty()}}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.graph;if(e){var t=e.layout,i=t.nodes,r=t.links,n=i.length+r.length,a=this.buildSeriesKey([n,e.plot.width,e.plot.height,i.length,r.length]);if(a!==this.graphKey||this.pixels.length!==2*n){this.graphKey=a,this.pixels.length!==2*n&&(this.pixels=new Float64Array(2*n));var o,s=_createForOfIteratorHelper(i);try{for(s.s();!(o=s.n()).done;){var l=o.value;this.pixels[2*l.id]=l.x-e.plot.x,this.pixels[2*l.id+1]=l.y-e.plot.y}}catch(e){s.e(e)}finally{s.f()}var h,u=_createForOfIteratorHelper(r);try{for(u.s();!(h=u.n()).done;){var c=h.value,d=sampleGraphLink(c,i,!1!==e.options.curve,4),f=d[Math.floor(d.length/2)]||[0,0],p=i.length+c.id;this.pixels[2*p]=f[0]-e.plot.x,this.pixels[2*p+1]=f[1]-e.plot.y}}catch(e){u.e(e)}finally{u.f()}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.graph;if(!i)return-1;var r,n=i.layout,a=n.nodes,o=n.links,s=i.plot,l=_createForOfIteratorHelper(a);try{for(l.s();!(r=l.n()).done;){var h=r.value,u=e-(h.x-s.x),c=t-(h.y-s.y),d=h.size/2*this.hoverBoost(h.id,.28)+3;if(u*u+c*c<=d*d)return h.id}}catch(e){l.e(e)}finally{l.f()}var f,p=!1!==i.options.curve,v=_createForOfIteratorHelper(o);try{for(v.s();!(f=v.n()).done;)for(var m=f.value,g=sampleGraphLink(m,a,p,12),b=1;b<g.length;b++){if(distanceToSegment(e,t,g[b-1][0]-s.x,g[b-1][1]-s.y,g[b][0]-s.x,g[b][1]-s.y)<=6)return a.length+m.id}}catch(e){v.e(e)}finally{v.f()}return-1}},{key:"doRender",value:function doRender(){var e=this.graph;if(e&&this.chartTheme){this.rebuildPixels();var t=this.ctx,i=this.chartTheme,r=e.plot,n=this.unit(),a=e.layout,o=a.nodes,s=a.links,l=!1!==e.options.curve,h=this.isEntering(),u=h?Math.max(0,Math.min(1,this.progress())):1,c=function positionOf(e){return h?[e.initialX+(e.x-e.initialX)*u,e.initialY+(e.y-e.initialY)*u]:[e.x,e.y]},d=o.map(function(e){var t=_slicedToArray(c(e),2),i=t[0],r=t[1];return _objectSpread2(_objectSpread2({},e),{},{x:i,y:r})});this.beginDraw(),t.globalAlpha=.55;var f,p=_createForOfIteratorHelper(s);try{for(p.s();!(f=p.n()).done;){var v=f.value,m=sampleGraphLink(v,d,l,16);if(!(m.length<2)){t.beginPath(),t.moveTo(m[0][0]-r.x,m[0][1]-r.y);for(var g=1;g<m.length;g++)t.lineTo(m[g][0]-r.x,m[g][1]-r.y);t.strokeStyle=v.color,t.lineWidth=Math.max(n,v.width*n),t.stroke()}}}catch(e){p.e(e)}finally{p.f()}t.globalAlpha=1;var b,k=_createForOfIteratorHelper(o);try{for(k.s();!(b=k.n()).done;){var S=b.value,w=_slicedToArray(c(S),2),A=w[0],_=w[1],M=A-r.x,C=_-r.y,T=Math.max(2,S.size/2*this.hoverBoost(S.id,.28));t.beginPath(),t.arc(M,C,T,0,2*Math.PI),t.fillStyle=S.color,t.fill(),t.strokeStyle="rgba(255,255,255,0.85)",t.lineWidth=n*(this.hoverBoost(S.id,.28)>1?2:1),t.stroke()}}catch(e){k.e(e)}finally{k.f()}this.setFont(i.fontSize,i.fontFamily),t.textAlign="center",t.textBaseline="middle",t.fillStyle=i.textColor;var P,I=_createForOfIteratorHelper(o);try{for(I.s();!(P=I.n()).done;){var O=P.value,N=_slicedToArray(c(O),2),D=N[0],H=N[1],R=D-r.x,E=H-r.y+O.size/2+9*n;t.strokeStyle=i.labelHaloColor,t.lineWidth=3*n,t.strokeText(O.name,R,E),t.fillText(O.name,R,E)}}catch(e){I.e(e)}finally{I.f()}this.endDraw()}}},{key:"nodeSizeAt",value:function nodeSizeAt(e){var t=this.graph,i=t&&t.layout.nodes[e];return i?i.size*this.hoverBoost(e,.28):10}}])}(),de=function(){function CurveSeriesBase(){var e;_classCallCheck(this,CurveSeriesBase);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,CurveSeriesBase,[].concat(i)),"curve",[]),_defineProperty(e,"curveKey",""),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"monotonicX",!0),e}return _inherits(CurveSeriesBase,G),_createClass(CurveSeriesBase,[{key:"resolvedParams",value:function resolvedParams(){var e=_objectSpread2({},this.series.option.params||{}),t=this.series.option.sweep;if(t&&t.name){var i=Number(t.from),r=Number(t.to),n=shouldAnimate()?this.sweepPhase():0;e[t.name]=i+(r-i)*n}return e}},{key:"sweepPhase",value:function sweepPhase(){var e=this.series.option.sweep;if(!e)return 0;var t=Math.max(200,Number(e.duration)||3e3),i=(Date.now()%t+t)%t/t;return"loop"===e.mode?i:1-Math.abs(2*i-1)}},{key:"paramValue",value:function paramValue(e){var t=this.resolvedParams();return"number"==typeof t[e]?t[e]:null}},{key:"syncSweep",value:function syncSweep(){var e=this.series.option.sweep;!!(e&&e.name&&shouldAnimate()&&!1!==this.state.display)?this.keepAnimating():this.stopAnimating()}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord;if(!e)return this.pixels=new Float64Array(0),void(this.curve=[]);this.syncSweep();var t=this.resolvedParams(),i=e.plot,r=_slicedToArray(this.parameterRange(i),2),n=r[0],a=r[1],o=this.buildSeriesKey([this.paramKey(t),i.width,i.height,Number(n).toPrecision(12),Number(a).toPrecision(12)]);if(o!==this.curveKey){this.curveKey=o;var s=this.series.points,l=s.length;this.pixels.length!==2*l&&(this.pixels=new Float64Array(2*l));for(var h=0;h<l;h++){var u=_slicedToArray(this.evaluateAt(Number(s[h].xValue),t),2),c=u[0],d=u[1],f=isFinite(c)?e.xScale.map(c):NaN,p=isFinite(d)?e.yScale.map(d):NaN;this.pixels[2*h]=f,this.pixels[2*h+1]=p}for(var v=this.sampleCurve(t,i),m=new Array(2*v.length),g=0;g<v.length;g++){var b=_slicedToArray(v[g],2),k=b[0],S=b[1];m[2*g]=isFinite(k)?e.xScale.map(k):NaN,m[2*g+1]=isFinite(S)?e.yScale.map(S):NaN}this.curve=m,this.xMonotonic=this.monotonicX,this.computeEffective(),this.renderIndices=null}}},{key:"paramKey",value:function paramKey(e){return Object.keys(e).sort().map(function(t){return"".concat(t,"=").concat(Number(e[t]).toPrecision(10))}).join(",")}},{key:"sampleCount",value:function sampleCount(){return this.rebuildPixels(),this.curve.length/2}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var i=this.pixels.length/2;if(!i)return-1;for(var r=this.series.option,n=Math.max(6,this.lineWidthDevice()+4)+(isFinite(Number(r.hitRadius))?Number(r.hitRadius):0),a=-1,o=n*n,s=0;s<i;s++){var l=this.pixels[2*s]-e,h=this.pixels[2*s+1]-t;if(isFinite(l)&&isFinite(h)){var u=l*l+h*h;u<=o&&(o=u,a=s)}}return a}},{key:"hoverLineScale",value:function hoverLineScale(){return null===this.hoverIndex?1:1+.45*this.highlightT()}},{key:"doRender",value:function doRender(){if(this.rebuildPixels(),this.curve.length){var e=this.ctx,t=this.unit(),i=this.pointColor(0),r=this.series.option;this.beginDraw(),e.strokeStyle=i,e.lineWidth=this.lineWidthDevice()*t*this.hoverLineScale(),"function"==typeof e.setLineDash&&Array.isArray(r.lineDash)&&e.setLineDash(r.lineDash.map(function(e){return e*t})),e.beginPath();for(var n=this.isEntering()?Math.max(.001,Math.min(1,this.progress())):1,a=this.curve.length/2,o=Math.max(1,Math.ceil(a*n)),s=!1,l=0;l<o;l++){var h=this.curve[2*l],u=this.curve[2*l+1];isFinite(h)&&isFinite(u)?s?e.lineTo(h,u):(e.moveTo(h,u),s=!0):s=!1}e.stroke(),"function"==typeof e.setLineDash&&e.setLineDash([]),this.endDraw()}}},{key:"curvePoints",value:function curvePoints(){return this.rebuildPixels(),this.curve}}])}(),fe=function(){function FunctionSeries(){var e;_classCallCheck(this,FunctionSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,FunctionSeries,[].concat(i)),"seriesType","function"),_defineProperty(e,"cachedSource",""),_defineProperty(e,"sampler",null),e}return _inherits(FunctionSeries,de),_createClass(FunctionSeries,[{key:"samplerFor",value:function samplerFor(e){var t=String(this.series.option.expression||"");if(t!==this.cachedSource||!this.sampler){this.cachedSource=t;try{this.sampler=compileSampler(t)}catch(e){this.sampler={setParams:function setParams(){},evaluate:function evaluate(){return NaN}}}}var i=this.sampler;return i.setParams(e),function(e){return i.evaluate("x",e)}}},{key:"evaluateAt",value:function evaluateAt(e,t){return[e,this.samplerFor(t)(e)]}},{key:"parameterRange",value:function parameterRange(e){var t=this.coord,i=t&&t.xScale&&t.xScale.domain;if(i&&i.length>=2){var r=Number(i[0]),n=Number(i[i.length-1]);if(isFinite(r)&&isFinite(n)&&n>r)return[r,n]}var a=this.series.option.domain;return[a?Number(a[0]):-10,a?Number(a[1]):10]}},{key:"baseSampleCount",value:function baseSampleCount(){var e=Number(this.series.option.samples);return Math.max(24,Math.min(4e3,isFinite(e)&&e>0?e:240))}},{key:"sampleCurve",value:function sampleCurve(e,t){var i=this.samplerFor(e),r=_slicedToArray(this.parameterRange(t),2);return sampleFunctionCurve(i,r[0],r[1],{base:this.baseSampleCount(),adaptive:!1!==this.series.option.adaptive,tolerance:this.series.option.samplingTolerance})}}])}(),pe=function(){function ParametricSeries(){var e;_classCallCheck(this,ParametricSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,ParametricSeries,[].concat(i)),"seriesType","parametric"),_defineProperty(e,"cachedSources",""),_defineProperty(e,"samplerX",null),_defineProperty(e,"samplerY",null),_defineProperty(e,"samplerR",null),e.monotonicX=!1,e}return _inherits(ParametricSeries,de),_createClass(ParametricSeries,[{key:"samplersFor",value:function samplersFor(e){var t=this.series.option,i=void 0===t.polarExpression||null===t.polarExpression?"":String(t.polarExpression);if(i){var r="polar\0".concat(i,"\0").concat(Object.keys(e).sort().join(","));if(r!==this.cachedSources||!this.samplerR){this.cachedSources=r;try{this.samplerR=compileSampler(i)}catch(e){this.samplerR={setParams:function setParams(){},evaluate:function evaluate(){return NaN}}}}var n=this.samplerR;return n.setParams(e),{x:function x(e){return n.evaluate("t",e)*Math.cos(e)},y:function y(e){return n.evaluate("t",e)*Math.sin(e)}}}var a=String(t.xExpression||""),o=String(t.yExpression||""),s="".concat(a,"\0").concat(o,"\0").concat(Object.keys(e).sort().join(","));if(s!==this.cachedSources||!this.samplerX||!this.samplerY){this.cachedSources=s;var l={setParams:function setParams(){},evaluate:function evaluate(){return NaN}};try{this.samplerX=compileSampler(a)}catch(e){this.samplerX=l}try{this.samplerY=compileSampler(o)}catch(e){this.samplerY=l}}var h=this.samplerX,u=this.samplerY;return h.setParams(e),u.setParams(e),{x:function x(e){return h.evaluate("t",e)},y:function y(e){return u.evaluate("t",e)}}}},{key:"evaluateAt",value:function evaluateAt(e,t){var i=this.samplersFor(t),r=i.x,n=i.y;return[r(e),n(e)]}},{key:"parameterRange",value:function parameterRange(e){var t=this.series.option.domain,i=t?Number(t[0]):0,r=t?Number(t[1]):2*Math.PI;return isFinite(i)&&isFinite(r)&&r!==i?[i,r]:[0,2*Math.PI]}},{key:"baseSampleCount",value:function baseSampleCount(){var e=Number(this.series.option.samples);return Math.max(24,Math.min(6e3,isFinite(e)&&e>0?e:360))}},{key:"sampleCurve",value:function sampleCurve(e,t){var i=this.samplersFor(e),r=i.x,n=i.y,a=_slicedToArray(this.parameterRange(t),2);return sampleParametricCurve(r,n,a[0],a[1],{base:this.baseSampleCount(),adaptive:!1!==this.series.option.adaptive,tolerance:this.series.option.samplingTolerance})}}])}(),ve=2*Math.PI,ye=function(){function LiquidSeries(){var e;_classCallCheck(this,LiquidSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,LiquidSeries,[].concat(i)),"seriesType","liquid"),_defineProperty(e,"liquid",null),_defineProperty(e,"liquidKey",""),_defineProperty(e,"fromRatio",null),e}return _inherits(LiquidSeries,G),_createClass(LiquidSeries,[{key:"setCoord",value:function setCoord(e){return this.liquid=e||null,this.liquidKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 6}},{key:"localCenter",value:function localCenter(){var e=this.liquid;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"range",value:function range(){var e=this.liquid&&this.liquid.options||{},t=isFinite(Number(e.min))?Number(e.min):0,i=isFinite(Number(e.max))?Number(e.max):100;return{min:t,max:i>t?i:t+1}}},{key:"targetRatio",value:function targetRatio(){var e=this.range(),t=e.min,i=e.max,r=this.series.points.length&&Number(this.series.points[0].y)||0;return Math.max(0,Math.min(1,(r-t)/(i-t)))}},{key:"currentRatio",value:function currentRatio(){var e=this.targetRatio(),t=Math.max(0,Math.min(1,this.progress())),i=null===this.fromRatio?0:this.fromRatio;return i+(e-i)*t}},{key:"levelRatio",value:function levelRatio(){return this.currentRatio()}},{key:"updateSeries",value:function updateSeries(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t&&this.liquid&&(this.fromRatio=this.currentRatio()),_superPropGet(LiquidSeries,"updateSeries",this,3)([e,t,i])}},{key:"phase",value:function phase(){var e=this.liquid&&this.liquid.options||{};if(!shouldAnimate())return 0;var t=isFinite(Number(e.waveSpeed))?Number(e.waveSpeed):1.6;return Date.now()/1e3*t}},{key:"syncWave",value:function syncWave(){var e=this.targetRatio();shouldAnimate()&&e>.001&&e<.999&&!1!==this.state.display?this.keepAnimating():this.stopAnimating()}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.liquid;if(e){var t=this.series.points.length&&Number(this.series.points[0].y)||0,i=this.buildSeriesKey([e.polar.radius,e.options.min,e.options.max,t]);if(i!==this.liquidKey||2!==this.pixels.length){this.liquidKey=i,2!==this.pixels.length&&(this.pixels=new Float64Array(2));var r=_slicedToArray(this.localCenter(),2),n=r[0],a=r[1];this.pixels[0]=n,this.pixels[1]=a,this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.liquid;if(!i||!this.series.points.length)return-1;var r=_slicedToArray(this.localCenter(),2),n=r[0],a=r[1];return Math.hypot(e-n,t-a)<=i.polar.radius+8?0:-1}},{key:"wavePath",value:function wavePath(e,t,i,r,n,a,o,s){var l=Math.max(1,2*r/64);e.beginPath(),e.moveTo(t-r,n+a*Math.sin(s));for(var h=-r+l;h<=r;h+=l)e.lineTo(t+h,n+a*Math.sin(h/o*ve+s))}},{key:"doRender",value:function doRender(){var e=this.liquid;if(e&&this.chartTheme){this.rebuildPixels(),this.syncWave();var t=this.ctx,i=this.chartTheme,r=e.options||{},n=this.unit(),a=_slicedToArray(this.localCenter(),2),o=a[0],s=a[1],l=e.polar.radius,h=Math.max(1,Number(r.borderWidth)||3)*n,u=Math.max(2,l-h),c=r.color||this.pointColor(0),d=this.currentRatio(),f=isFinite(Number(r.waveHeight))?Number(r.waveHeight):.06,p=Math.max(.15,isFinite(Number(r.waveLength))?Number(r.waveLength):1.2)*u,v=f*u,m=this.phase();this.beginDraw(),t.beginPath(),t.arc(o,s,u,0,ve),t.fillStyle=hexToRgba(c,.1),t.fill(),t.save(),t.beginPath(),t.arc(o,s,u,0,ve),t.clip();for(var g=s+u-2*u*d,b=0,k=[{phase:m,alpha:.34,ampScale:1.25},{phase:m+.6*Math.PI,alpha:.55,ampScale:1}];b<k.length;b++){var S=k[b];this.wavePath(t,o,s,u,g,v*S.ampScale,p,S.phase),t.lineTo(o+u,s+u+2*v),t.lineTo(o-u,s+u+2*v),t.closePath(),t.globalAlpha=S.alpha;var w=t.createLinearGradient?t.createLinearGradient(0,g-v,0,s+u):null;w?(w.addColorStop(0,hexToRgba(c,.95)),w.addColorStop(1,hexToRgba(c,.55)),t.fillStyle=w):t.fillStyle=c,t.fill(),t.globalAlpha=1}t.restore(),t.beginPath(),t.arc(o,s,l-h/2,0,ve),t.strokeStyle=r.borderColor||hexToRgba(c,.6),t.lineWidth=h,t.stroke();var A=r.detail||{};if(!1!==A.show){var _=this.range().min,M=_+((this.series.points.length&&Number(this.series.points[0].y)||0)-_)*Math.max(0,Math.min(1,this.progress())),C="function"==typeof A.formatter?A.formatter(M):"".concat(Number(M.toPrecision(4))).concat(void 0===r.unit?"%":r.unit),T=this.series.points.length?this.series.points[0].name:void 0;T&&!1!==r.title&&(this.setFont(i.fontSize,i.fontFamily),t.fillStyle=i.subTextColor,t.textAlign="center",t.textBaseline="middle",t.fillText(String(T),o,s-.9*(Number(A.fontSize)||.28*l)*n));var P=isFinite(Number(A.fontSize))?Number(A.fontSize):Math.max(14,.42*l);this.setFont(P*n,i.fontFamily,"bold"),t.fillStyle=r.textColor||i.textColor,t.textAlign="center",t.textBaseline="middle",t.fillText(C,o,s+(T?.18*P*n:0))}this.endDraw()}}}])}(),me={bar:function bar(e,t){return new q(e,t)},area:function area(e,t){return new $(e,t)},line:function line(e,t){return new Y(e,t)},scatter:function scatter(e,t){return new Z(e,t)},pie:function pie(e,t){return new Q(e,t)},radar:function radar(e,t){return new ee(e,t)},candlestick:function candlestick(e,t){return new te(e,t)},heatmap:function heatmap(e,t){return new ie(e,t)},sankey:function sankey(e,t){return new re(e,t)},funnel:function funnel(e,t){return new ne(e,t)},gauge:function gauge(e,t){return new se(e,t)},boxplot:function boxplot(e,t){return new le(e,t)},waterfall:function waterfall(e,t){return new he(e,t)},treemap:function treemap(e,t){return new ue(e,t)},graph:function graph(e,t){return new ce(e,t)},function:function _function(e,t){return new fe(e,t)},parametric:function parametric(e,t){return new pe(e,t)},liquid:function liquid(e,t){return new ye(e,t)}},xe={},ge=/^[a-zA-Z][\w-]*$/;function getSeriesTypeFactory(e){return Object.prototype.hasOwnProperty.call(me,e)?me[e]:xe[e]||null}function createSeriesComponent(e,t){return(getSeriesTypeFactory(String(e.type))||me.line)(e,t)}var be=function(){return _createClass(function HitResolver(e){_classCallCheck(this,HitResolver),this.host=e},[{key:"resolveTarget",value:function resolveTarget(e,t){var i=this.host.ice,r={kind:"none",component:null,index:-1,local:[0,0],chart:[0,0]};if(!i||"function"!=typeof i.hitTest)return r;var n=_slicedToArray(i.screenToWorld(e,t),2),a=n[0],o=n[1],s=[a,o],l=i.hitTest(e,t);if(!l)return _objectSpread2(_objectSpread2({},r),{},{chart:s});var h=l.globalToLocal?l.globalToLocal(a,o):[0,0];if(l===this.host.plotArea)return{kind:"plot",component:l,index:-1,local:h,chart:s};if(l===this.host.legend)return{kind:"legend",component:l,index:this.host.legend&&"function"==typeof this.host.legend.hitItem?this.host.legend.hitItem(h[0],h[1]):-1,local:h,chart:s};if("function"==typeof l.hitTestIndex){var u=l.hitTestIndex(h[0],h[1]);return{kind:u>=0?"series":"other",component:l,index:u,local:h,chart:s}}return{kind:"other",component:l,index:-1,local:h,chart:s}}},{key:"isInsidePlot",value:function isInsidePlot(e,t){var i=this.host.layout.plot;return e>=i.x&&e<=i.x+i.width&&t>=i.y&&t<=i.y+i.height}},{key:"seriesComponentOf",value:function seriesComponentOf(e){if(!e)return null;var t,i=_createForOfIteratorHelper(this.host.seriesComponents);try{for(i.s();!(t=i.n()).done;){var r=t.value;if(r.series===e)return r}}catch(e){i.e(e)}finally{i.f()}var n=e.id;if(null!=n){var a,o=_createForOfIteratorHelper(this.host.seriesComponents);try{for(o.s();!(a=o.n()).done;){var s=a.value;if(s.series&&s.series.id===n)return s}}catch(e){o.e(e)}finally{o.f()}}return null}},{key:"seriesOfComponent",value:function seriesOfComponent(e){var t,i=_createForOfIteratorHelper(this.host.norm.series);try{for(i.s();!(t=i.n()).done;){var r=t.value;if(this.seriesComponentOf(r)===e)return r}}catch(e){i.e(e)}finally{i.f()}return null}},{key:"buildActiveItem",value:function buildActiveItem(e,t){var i=this.seriesComponentOf(e);if(!i)return null;var r=i.pixelAt(t),n=e.points[t];if(!r||!n)return null;var a=this.host.layout.plot;return{series:e,point:n,pixel:[a.x+r[0],a.y+r[1]],screen:[0,0]}}},{key:"toParams",value:function toParams(e){var t=this.host.ice,i=t&&"function"==typeof t.worldToScreen?t.worldToScreen(e.pixel[0],e.pixel[1]):e.pixel;return{seriesId:e.series.id,seriesName:e.series.name,seriesIndex:e.series.index,seriesType:e.series.type,color:e.series.color,dataIndex:e.point.index,data:e.point.raw,xValue:e.point.xValue,value:e.point.y,screen:[i[0],i[1]]}}},{key:"pickColumn",value:function pickColumn(e){var t=e-this.host.layout.plot.x,i=this.host.norm.series.filter(function(e){return!e.hidden});if(!i.length)return null;var r,n=[],a=null,o=_createForOfIteratorHelper(i);try{for(o.s();!(r=o.n()).done;){var s=r.value,l=this.seriesComponentOf(s);if(l){var h=this.nearestIndexByX(l,t);if(!(h<0)){var u=this.buildActiveItem(s,h);u&&(n.push(u),null===a&&(a=s.points[h].xValue))}}}}catch(e){o.e(e)}finally{o.f()}return n.length?{dataIndex:n[0].point.index,xValue:a,pixelX:n[0].pixel[0],items:n}:null}},{key:"nearestIndexByX",value:function nearestIndexByX(e,t){return e.nearestIndexAtX(t)}},{key:"nearestByXValue",value:function nearestByXValue(e){var t,i=this.host.norm.series.filter(function(e){return!e.hidden}),r=this.host.norm.hiddenSlices||{},n=null,a=_createForOfIteratorHelper(i);try{for(a.s();!(t=a.n()).done;)for(var o=t.value,s=0;s<o.points.length;s++)if("pie"!==o.type&&"funnel"!==o.type||!r["".concat(o.id,"#").concat(s)]){var l=valueDistance(e,o.points[s].xValue);null!==l&&(!n||l<n.dist)&&(n={series:o,index:s,dist:l})}}catch(e){a.e(e)}finally{a.f()}return n?this.buildActiveItem(n.series,n.index):null}}])}();function valueDistance(e,t){var i=e instanceof Date?e.getTime():Number(e),r=t instanceof Date?t.getTime():Number(t);return isFinite(i)&&isFinite(r)?Math.abs(i-r):String(e)===String(t)?0:null}var ke=null,Se=function(){return _createClass(function InteractionController(e){_classCallCheck(this,InteractionController),_defineProperty(this,"hover",null),_defineProperty(this,"selection",[]),_defineProperty(this,"drag",null),_defineProperty(this,"bound",!1),_defineProperty(this,"lastDimmed",null),_defineProperty(this,"keyboardIndex",0),this.host=e,this.resolver=new be(e)},[{key:"bind",value:function bind(){if(this.bound)return this;var e=this.host.ice&&this.host.ice.evtBus;return e?(this.bound=!0,e.on("mousemove",this.onBusMove,this),e.on("mousedown",this.onBusDown,this),e.on("mouseup",this.onBusUp,this),e.on("click",this.onBusClick,this),e.on("dblclick",this.onBusDoubleClick,this),e.on("wheel",this.onBusWheel,this),e.on("keydown",this.onBusKeyDown,this),this):this}},{key:"unbind",value:function unbind(){if(this.bound){this.bound=!1;var e=this.host.ice&&this.host.ice.evtBus;e&&(e.off("mousemove",this.onBusMove,this),e.off("mousedown",this.onBusDown,this),e.off("mouseup",this.onBusUp,this),e.off("click",this.onBusClick,this),e.off("dblclick",this.onBusDoubleClick,this),e.off("wheel",this.onBusWheel,this),e.off("keydown",this.onBusKeyDown,this))}}},{key:"pointOf",value:function pointOf(e){if(!e)return null;var t="number"==typeof e.offsetX?e.offsetX:e.x,i="number"==typeof e.offsetY?e.offsetY:e.y;return"number"!=typeof t||"number"!=typeof i?null:[t,i]}},{key:"isOverCanvas",value:function isOverCanvas(e,t){var i=this.host&&this.host.ice;if(!i)return!1;var r=i.dpr||1,n=(i.canvasWidth||0)/r,a=(i.canvasHeight||0)/r;return!(n>0&&a>0)||e>=0&&t>=0&&e<=n&&t<=a}},{key:"preventDefault",value:function preventDefault(e){var t=e&&e.originalEvent?e.originalEvent:e;if(t&&"function"==typeof t.preventDefault)try{t.preventDefault()}catch(e){}}},{key:"onBusMove",value:function onBusMove(e){var t=this.pointOf(e);t&&this.handlePointerMove(t[0],t[1],e)}},{key:"onBusDown",value:function onBusDown(e){var t=this.pointOf(e);t&&this.handlePointerDown(t[0],t[1],e)}},{key:"onBusUp",value:function onBusUp(e){var t=this.pointOf(e);t&&this.handlePointerUp(t[0],t[1],e)}},{key:"onBusClick",value:function onBusClick(e){var t=this.pointOf(e);t&&this.handleClick(t[0],t[1],e)}},{key:"onBusDoubleClick",value:function onBusDoubleClick(e){var t=this.pointOf(e);t&&this.handleDoubleClick(t[0],t[1],e)}},{key:"onBusWheel",value:function onBusWheel(e){var t=this.pointOf(e);t&&this.handleWheel(t[0],t[1],Number(e.deltaY)||0,e)}},{key:"onBusKeyDown",value:function onBusKeyDown(e){this.handleKeyDown(e&&e.key,e)}},{key:"refreshHover",value:function refreshHover(){var e=this.hover;if(e){var t=this.host.norm;if("item"===e.kind){var i=t.series.find(function(t){return t.id===e.item.series.id})||e.item.series,r=e.item.point.index,n=("pie"===i.type||"funnel"===i.type)&&t.hiddenSlices["".concat(i.id,"#").concat(r)];if(i.hidden||n||!i.points[r])return void this.setHover(null);var a=this.resolver.buildActiveItem(i,r);return a&&this.resolver.isInsidePlot(a.pixel[0],a.pixel[1])?void this.setHover({kind:"item",item:a}):void this.setHover(null)}var o=this.resolver.nearestByXValue(e.column.xValue),s=o?this.resolver.pickColumn(o.pixel[0]):null;s&&("cartesian"!==t.kind||this.resolver.isInsidePlot(s.pixelX,s.items[0].pixel[1]))?this.setHover({kind:"axis",column:s}):this.setHover(null)}}},{key:"resolveTarget",value:function resolveTarget(e,t){return this.resolver.resolveTarget(e,t)}},{key:"handlePointerMove",value:function handlePointerMove(e,t,i){this.drag?this.updateDrag(e,t,i):this.isOverCanvas(e,t)&&this.updateHover(e,t)}},{key:"updateHover",value:function updateHover(e,t){var i=this.host.norm.option.interaction;if(!i||!i.hover||!1!==i.hover.enabled){var r=this.resolveTarget(e,t);if("legend"===r.kind){var n=this.host.legend;return n&&n.hoverIndex!==r.index&&(n.hoverIndex=r.index,n.markDirty()),this.clearDataVisuals(),void this.setHoverState(null)}this.resetLegendHover();var a=this.host.norm.option.tooltip&&this.host.norm.option.tooltip.trigger||"axis";if(this.resolver.isInsidePlot(r.chart[0],r.chart[1])&&"axis"===a){var o=this.resolver.pickColumn(r.chart[0]);if(o)return void this.setHover({kind:"axis",column:o})}if("series"===r.kind&&r.index>=0){var s=this.resolver.seriesOfComponent(r.component),l=s?this.resolver.buildActiveItem(s,r.index):null;if(l)return void this.setHover({kind:"item",item:l})}this.setHover(null)}}},{key:"resetLegendHover",value:function resetLegendHover(){var e=this.host.legend;e&&-1!==e.hoverIndex&&(e.hoverIndex=-1,e.markDirty())}},{key:"setHover",value:function setHover(e){var t=!!this.hover;if(this.hover=e,!e)return this.clearHoverVisuals(),this.dimOthers(null),void(t&&this.host.emit("item:leave",void 0));this.applyHoverVisuals(e),"item"===e.kind?(this.keyboardIndex=e.item.point.index,this.dimOthers(e.item.series.id),this.host.emit("item:hover",this.resolver.toParams(e.item))):(this.dimOthers(null),e.column.items[0]&&this.host.emit("item:hover",this.resolver.toParams(e.column.items[0])))}},{key:"setHoverState",value:function setHoverState(e){this.hover=e}},{key:"applyHoverVisuals",value:function applyHoverVisuals(e){var t=this,i="item"===e.kind?[e.item]:e.column.items,r=i[0];this.syncSeriesHover(i);var n=this.host.highlight;n&&n.setHover(i.map(function(e){return t.markFor(e)}));var a=this.host.crosshair;if(a)if("cartesian"!==this.host.norm.kind||"horizontal"===this.host.norm.orientation)a.hide();else{var o=this.host.norm.option.crosshair&&this.host.norm.option.crosshair.axis||"x";a.show("y"===o?null:r.pixel[0],"x"===o?null:r.pixel[1],this.host.formatAxisValue("x",r.point.xValue),null===r.point.y?"":this.host.formatAxisValue("y",r.point.y))}var s=this.host.tooltip;if(s)if(this.host.norm.option.tooltip&&!1===this.host.norm.option.tooltip.show)s.hide();else{var l=this.buildTooltipContent(e),h="axis"===e.kind?[e.column.pixelX,r.pixel[1]]:[r.pixel[0],r.pixel[1]];s.show(l,h)}}},{key:"buildTooltipContent",value:function buildTooltipContent(e){var t=this,i="item"===e.kind?[e.item]:e.column.items,r=i[0];if(r&&"horizontal"===this.host.norm.orientation)return{title:this.host.formatAxisValue("y",r.point.xValue),rows:i.map(function(e){return{name:e.series.name,value:null===e.point.y?"-":t.host.formatAxisValue("x",e.point.y),color:e.series.color}})};if(r&&"pie"===r.series.type){var n,a=r.series,o=r.point,s=0,l=_createForOfIteratorHelper(a.points);try{for(l.s();!(n=l.n()).done;){var h=n.value;this.host.norm.hiddenSlices["".concat(a.id,"#").concat(h.index)]||(s+=h.y||0)}}catch(e){l.e(e)}finally{l.f()}var u=o.y||0,c=s>0?u/s*100:0;return{title:a.name,rows:[{name:o.name||"".concat(this.host.norm.labels.slice," ").concat(o.index+1),value:"".concat(c.toFixed(1),"%"),color:o.color||a.color}]}}if(r&&"funnel"===r.series.type){var d,f=r.series,p=r.point,v=0,m=_createForOfIteratorHelper(f.points);try{for(m.s();!(d=m.n()).done;){var g=d.value;this.host.norm.hiddenSlices["".concat(f.id,"#").concat(g.index)]||(v+=g.y||0)}}catch(e){m.e(e)}finally{m.f()}var b=v>0?(p.y||0)/v*100:0;return{title:p.name||this.host.formatAxisValue("x",p.xValue),rows:[{name:f.name,value:"".concat(null===p.y?"-":p.y,"(").concat(b.toFixed(1),"%)"),color:p.color||f.color}]}}if(r&&"gauge"===r.series.type){var k=r.series,S=r.point;return{title:S.name||k.name,rows:[{name:k.name,value:null===S.y?"-":String(S.y),color:k.color}]}}if(r&&"liquid"===r.series.type){var w=r.series,A=r.point,_=w.option.liquid||{},M=isFinite(Number(_.min))?Number(_.min):0,C=isFinite(Number(_.max))?Number(_.max):100,T=null===A.y?M:Number(A.y),P=C>M?Math.max(0,Math.min(1,(T-M)/(C-M))):0;return{title:A.name||w.name,rows:[{name:w.name,value:"".concat(T).concat(void 0===_.unit?"%":_.unit),color:w.color},{name:this.host.norm.labels.liquid,value:"".concat((100*P).toFixed(1),"%"),color:this.host.norm.theme.subTextColor}]}}if(r&&("function"===r.series.type||"parametric"===r.series.type)){var I,O,N=r.series,D=r.point.raw||{},H="function"===N.type,R=H?"x":"t",E=Number(H?null!==(I=D.x)&&void 0!==I?I:r.point.xValue:null!==(O=D.t)&&void 0!==O?O:r.point.xValue),L=Number(D.x),z=Number(D.y),B=function fmt(e){return isFinite(e)?String(Number(e.toPrecision(4))):"—"};return{title:"".concat(R," = ").concat(B(E)),rows:H?[{name:N.name,value:B(z),color:N.color},{name:this.host.norm.labels.coordinate,value:"(".concat(B(L),", ").concat(B(z),")"),color:this.host.norm.theme.subTextColor}]:[{name:this.host.norm.labels.coordinate,value:"(".concat(B(L),", ").concat(B(z),")"),color:N.color},{name:"y",value:B(z),color:this.host.norm.theme.subTextColor}]}}if(r&&"radar"===r.series.type){var W=r.series;return{title:W.name,rows:W.points.map(function(e){return{name:e.name||"".concat(e.index+1),value:null===e.y?"-":String(e.y),color:e.index===r.point.index?W.color:t.host.norm.theme.subTextColor}})}}if(r&&"candlestick"===r.series.type){var V=r.point,j=V.ohlc||[0,0,0,0];return{title:this.host.formatAxisValue("x",V.xValue),rows:[{name:"开盘",value:String(j[0]),color:r.series.color},{name:"收盘",value:String(j[1]),color:r.series.color},{name:"最低",value:String(j[2]),color:r.series.color},{name:"最高",value:String(j[3]),color:r.series.color}]}}if(r&&"boxplot"===r.series.type){var U=r.point,X=U.boxplot;if(X){var K=["最小值","下四分位","中位数","上四分位","最大值"];return{title:U.name||this.host.formatAxisValue("x",U.xValue),rows:X.map(function(e,t){return{name:K[t],value:String(e),color:r.series.color}})}}}if(r&&"waterfall"===r.series.type){var G=r.point,Y=G.y||0;return{title:G.name||this.host.formatAxisValue("x",G.xValue),rows:[{name:Y>=0?"增加":"减少",value:"".concat(Y>=0?"+":"").concat(Y),color:r.series.color},{name:"累计",value:String(G.top),color:this.host.norm.theme.subTextColor}]}}if(r&&"treemap"===r.series.type){var q=r.series,$=r.point;q.points.find(function(e){return 0===e.index})&&q.points[0].y;var Z,J=$.y||0,Q=0,ee=_createForOfIteratorHelper(q.points);try{for(ee.s();!(Z=ee.n()).done;){var te=Z.value,ie=te.raw;ie&&Array.isArray(ie.children)&&ie.children.length||(Q+=te.y||0)}}catch(e){ee.e(e)}finally{ee.f()}var re=Q>0?J/Q*100:0;return{title:$.name||String($.xValue),rows:[{name:q.name,value:"".concat(J,"(").concat(re.toFixed(1),"%)"),color:r.series.color}]}}if(r&&"graph"===r.series.type){var ne=this.resolver.seriesComponentOf(r.series),ae=r.point,oe=ne&&ne.nodeCount||0;if(ae.index>=oe){var se=ne&&ne.graph?ne.graph.layout.links[ae.index-oe]:null,le=ne&&ne.graph?ne.graph.layout.nodes:[];return{title:ae.name,rows:[{name:"流量",value:String(se?se.value:ae.y),color:se?se.color:r.series.color}].concat(_toConsumableArray(se&&le[se.source]&&le[se.target]?[{name:"度数",value:String(le[se.source].degree+le[se.target].degree),color:this.host.norm.theme.subTextColor}]:[]))}}return{title:ae.name,rows:[{name:"权重",value:null===ae.y?"-":String(ae.y),color:r.series.color},{name:"连接数",value:String(ne&&ne.graph&&ne.graph.layout.nodes[ae.index]?ne.graph.layout.nodes[ae.index].degree:0),color:this.host.norm.theme.subTextColor}]}}if(r&&"heatmap"===r.series.type){var he=r.point;return{title:he.name||this.host.formatAxisValue("x",he.xValue),rows:[{name:this.host.formatAxisValue("x",he.xValue),value:null===he.y?"-":this.host.formatAxisValue("y",he.y),color:he.color||r.series.color}]}}if(r&&"sankey"===r.series.type){var ue=r.point,ce=!(!ue.raw||!ue.raw.__sankeyLink);return{title:ce?ue.name:"节点",rows:[{name:ce?"流量":ue.name,value:null===ue.y?"-":String(ue.y),color:r.series.color}]}}var de="item"===e.kind?e.item.point.xValue:e.column.xValue,fe=this.host.formatAxisValue("x",de),pe=i.map(function(e){return{name:e.series.name,value:null===e.point.y?"-":t.host.formatAxisValue("y",e.point.y),color:e.series.color}}),ve=this.host.norm.option.tooltip&&this.host.norm.option.tooltip.formatter;if("function"==typeof ve){var ye=ve({items:i.map(function(e){return t.resolver.toParams(e)}),dataIndex:"item"===e.kind?e.item.point.index:e.column.dataIndex,xValue:de});if(Array.isArray(ye))return{title:void 0===ye[0]?fe:String(ye[0]),rows:ye.slice(1).map(function(e,t){return{name:String(e),value:"",color:i[t]?i[t].series.color:"#999999"}})};if("string"==typeof ye)return{title:ye,rows:[]};if(ye&&"object"===_typeof(ye)&&(void 0!==ye.title||void 0!==ye.rows))return{title:ye.title||fe,rows:ye.rows||pe}}return{title:fe,rows:pe}}},{key:"clearHoverVisuals",value:function clearHoverVisuals(){this.clearDataVisuals(),this.resetLegendHover()}},{key:"clearDataVisuals",value:function clearDataVisuals(){this.syncSeriesHover([]),this.host.highlight&&this.host.highlight.setHover([]),this.host.crosshair&&this.host.crosshair.hide(),this.host.tooltip&&this.host.tooltip.hide()}},{key:"syncSeriesHover",value:function syncSeriesHover(e){var t,i=new Map,r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;i.has(n.series.id)||i.set(n.series.id,n.point.index)}}catch(e){r.e(e)}finally{r.f()}var a,o=_createForOfIteratorHelper(this.host.seriesComponents);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=i.get(s.series.id);s.setHoverIndex(void 0===l?null:l)}}catch(e){o.e(e)}finally{o.f()}}},{key:"markFor",value:function markFor(e){var t,i,r=this.resolver.seriesComponentOf(e.series),n=this.host.layout.plot;if(r&&"bar"===e.series.type&&"function"==typeof r.barRectAt){var a=("function"==typeof r.barDrawRectAt?r.barDrawRectAt(e.point.index,1):null)||r.barRectAt(e.point.index),o=a?{x:Math.max(a.x,0),y:Math.max(a.y,0),width:Math.max(0,Math.min(a.x+a.width,n.width)-Math.max(a.x,0)),height:Math.max(0,Math.min(a.y+a.height,n.height)-Math.max(a.y,0))}:null;if(o&&o.width>0&&o.height>0)return{x:n.x+o.x+o.width/2,y:n.y+o.y+o.height/2,width:o.width,height:o.height,color:e.series.color,size:0,shape:"rect"}}return{x:e.pixel[0],y:e.pixel[1],color:e.series.color,size:(t=e.series,i=t.option&&t.option.symbolSize,isFinite(i)?Number(i):"bar"===t.type?10:8),shape:"circle"}}},{key:"dimOthers",value:function dimOthers(e){var t=this.host.norm.option.interaction,i=!!(t&&t.hover&&t.hover.dimOthers),r=i?e:null;if(r!==this.lastDimmed){this.lastDimmed=r;var n,a=this.host.norm.theme.selection.dimOpacity,o=_createForOfIteratorHelper(this.host.seriesComponents);try{for(o.s();!(n=o.n()).done;){var s=n.value,l=i&&null!==r&&s.series.id!==r;s.setState({opacity:l?a:1})}}catch(e){o.e(e)}finally{o.f()}}}},{key:"handlePointerDown",value:function handlePointerDown(e,t,i){if(!this.isOverCanvas(e,t))return!1;ke=this;var r=this.resolveTarget(e,t);if("legend"===r.kind)return!0;var n=this.host.dataZoomSlider;if(n&&r.component===n){var a=n.hitPart(r.local[0],r.local[1]);if(a){this.preventDefault(i),this.setHover(null);var o=n.fractionAt(r.local[0]);if(this.drag={mode:"slider",part:a,startX:e,startY:t,originStart:n.start,originEnd:n.end,anchorFraction:o,moved:!1},n.setActive(a),"track"===a){var s=n.end-n.start,l=clamp$2(o-s/2,0,1-s);this.host.setDomainFromFractions(l,l+s,"slider",!0),n.setActive("window"),this.drag.part="window",this.drag.originStart=l,this.drag.originEnd=l+s}return!0}}if("series"===r.kind&&r.index>=0&&r.component&&"graph"===r.component.seriesType&&"function"==typeof r.component.moveNode&&r.index<(r.component.nodeCount||0)&&(!r.component.graph||!1!==r.component.graph.options.draggable))return this.preventDefault(i),this.setHover(null),this.drag={mode:"graph-node",component:r.component,nodeIndex:r.index,startX:e,startY:t,moved:!1},!0;if(r.component&&"function"==typeof this.host.isMarkComponent&&this.host.isMarkComponent(r.component))return this.setHover(null),!1;if(!this.resolver.isInsidePlot(r.chart[0],r.chart[1]))return!1;var h=this.host.norm.option.interaction||{},u=h.brush,c=h.pan,d=!(!u||!1===u||!1===u.enabled),f=!(!c||!1===c||!c.enabled);return this.preventDefault(i),d?(this.setHover(null),this.drag={mode:"brush",startX:e,startY:t,moved:!1},this.host.brush&&this.host.brush.setRect({x:r.chart[0],y:r.chart[1],width:0,height:0}),!0):!!f&&(this.setHover(null),this.drag={mode:"pan",startX:e,startY:t,domainX:2===this.host.norm.xAxis.domain.length?[this.host.norm.xAxis.domain[0],this.host.norm.xAxis.domain[1]]:null,domainY:[this.host.norm.yAxis.domain[0],this.host.norm.yAxis.domain[1]],moved:!1},!0)}},{key:"handlePointerUp",value:function handlePointerUp(e,t,i){"function"==typeof this.host.finishMarkDrag&&this.host.finishMarkDrag();var r=this.drag;if(r){if(this.drag=null,"brush"===r.mode){if(!r.moved)return this.host.brush&&this.host.brush.setRect(null),void this.updateHover(e,t);var n=this.brushRange(),a=this.host.norm.option.interaction&&this.host.norm.option.interaction.brush;return a&&"zoom"===a.mode&&n&&(this.applyRange(n),this.host.brush&&this.host.brush.setRect(null)),this.host.emit("brush:end",n),void this.updateHover(e,t)}if("slider"===r.mode){var o=this.host.dataZoomSlider;return o&&o.setActive(null),void this.updateHover(e,t)}if("graph-node"===r.mode){var s=r.component;return r.moved&&s&&"function"==typeof s.settle&&s.graph&&!1!==s.graph.options.settleOnDrop&&s.settle(),void this.updateHover(e,t)}"pan"===r.mode&&this.updateHover(e,t)}}},{key:"updateDrag",value:function updateDrag(e,t,i){var r=this.drag;if(r){var n=e-r.startX,a=t-r.startY;if(r.moved||!(Math.abs(n)+Math.abs(a)<3)){r.moved=!0;var o=this.host.layout.plot,s=_slicedToArray(this.host.ice.screenToWorld(r.startX,r.startY),2),l=s[0],h=s[1],u=_slicedToArray(this.host.ice.screenToWorld(e,t),2),c=u[0],d=u[1];if("brush"!==r.mode)if("slider"!==r.mode)if("graph-node"!==r.mode){var f=this.host.norm.option.interaction&&this.host.norm.option.interaction.pan,p=f&&f.axes||"xy";if(("x"===p||"xy"===p)&&r.domainX){var v=this.shiftDomain("x",r.domainX,n);v&&this.host.setDomain("x",v,"pan")}if(("y"===p||"xy"===p)&&r.domainY){var m=this.shiftDomain("y",r.domainY,a);m&&this.host.setDomain("y",m,"pan")}}else{r.moved=!0;var g=r.component,b=_slicedToArray(this.host.ice.screenToWorld(e,t),2),k=b[0],S=b[1],w=g.globalToLocal(k,S);g.moveNode(r.nodeIndex,w[0],w[1]);var A=this.seriesOfGraphComponent(g);if(A){var _=this.resolver.buildActiveItem(A,r.nodeIndex);_&&this.setHover({kind:"item",item:_})}}else{var M=this.host.dataZoomSlider;if(!M)return;r.moved=!0;var C=_slicedToArray(this.host.ice.screenToWorld(e,t),2),T=C[0],P=C[1],I=M.globalToLocal(T,P)[0],O=M.fractionAt(I),N=r.originEnd-r.originStart,D=r.originStart,H=r.originEnd;if("start"===r.part)D=clamp$2(O,0,r.originEnd-.02);else if("end"===r.part)H=clamp$2(O,r.originStart+.02,1);else{var R=O-r.anchorFraction;H=(D=clamp$2(r.originStart+R,0,1-N))+N}this.host.setDomainFromFractions(D,H,"slider",!0)}else{var E=clamp$2(l,o.x,o.x+o.width),L=clamp$2(h,o.y,o.y+o.height),z=clamp$2(c,o.x,o.x+o.width),B=clamp$2(d,o.y,o.y+o.height);this.host.brush&&this.host.brush.setRect({x:Math.min(E,z),y:Math.min(L,B),width:Math.abs(z-E),height:Math.abs(B-L)});var W=this.brushRange();W&&this.host.emit("brush:change",W)}}}}},{key:"shiftDomain",value:function shiftDomain(e,t,i){var r=this.host.norm["x"===e?"xAxis":"yAxis"],n=r.scale;if(!n)return null;var a="x"===e?this.host.layout.plot.width:this.host.layout.plot.height;if(n.isBand()){var o=r.domain,s=o.indexOf(t[0]),l=o.indexOf(t[1]);if(s<0||l<0||o.length<=1)return null;var h=n.step()||a/Math.max(1,o.length),u=l-s,c=clamp$2(s+Math.round(-i/h),0,Math.max(0,o.length-1-u));return[o[c],o[c+u]]}var d=Number(t[1])-Number(t[0]),f=-i/Math.max(1,a)*d;return[Number(t[0])+f,Number(t[1])+f]}},{key:"handleClick",value:function handleClick(e,t,i){if(this.isOverCanvas(e,t)){var r=this.resolveTarget(e,t),n=this.host.norm.option.interaction;if("legend"!==r.kind){if("series"===r.kind&&r.index>=0){var a=this.resolver.seriesOfComponent(r.component),o=a?this.resolver.buildActiveItem(a,r.index):null;if(o){var s=this.resolver.toParams(o);this.host.emit("item:click",s);var l=n&&n.select;return void(l&&l.enabled&&this.toggleSelection(o.series.id,o.point.index,l.mode||"single",!1!==l.toggle))}}if(this.resolver.isInsidePlot(r.chart[0],r.chart[1])){var h=this.host.layout.plot;this.host.emit("plot:click",{screen:[e,t],xValue:this.host.norm.xAxis.scale?this.host.norm.xAxis.scale.invert(r.chart[0]-h.x):void 0,yValue:this.host.norm.yAxis.scale?this.host.norm.yAxis.scale.invert(r.chart[1]-h.y):void 0})}else this.host.emit("chart:click",{screen:[e,t]})}else{var u=this.host.legend;if(u&&r.index>=0){var c=u.items[r.index];void 0!==c.dataIndex?this.host.toggleSlice(c.seriesId,c.dataIndex):this.host.toggleSeries(c.seriesId)}}}}},{key:"handleDoubleClick",value:function handleDoubleClick(e,t,i){if(this.isOverCanvas(e,t)){var r=this.resolveTarget(e,t);if(!("series"!==r.kind||r.index<0)){var n=this.resolver.seriesOfComponent(r.component),a=n?this.resolver.buildActiveItem(n,r.index):null;a&&this.host.emit("item:dblclick",this.resolver.toParams(a))}}}},{key:"toggleSelection",value:function toggleSelection(e,t,i,r){var n=this.selection.findIndex(function(i){return i.seriesId===e&&i.dataIndex===t});"single"===i?this.selection=n>=0&&r?[]:[{seriesId:e,dataIndex:t}]:n>=0?this.selection.splice(n,1):this.selection.push({seriesId:e,dataIndex:t}),this.refreshSelectionVisuals(),this.host.emit("select:change",this.getSelectedParams())}},{key:"clearSelection",value:function clearSelection(){this.selection.length&&(this.selection=[],this.refreshSelectionVisuals(),this.host.emit("select:change",[]))}},{key:"refreshSelectionVisuals",value:function refreshSelectionVisuals(){var e=this,t=this.host.highlight;if(t){var i,r=[],n=_createForOfIteratorHelper(this.selection);try{var a=function _loop(){var t=i.value,n=e.host.norm.series.find(function(e){return e.id===t.seriesId});if(!n)return 1;var a=e.resolver.buildActiveItem(n,t.dataIndex);a&&r.push(e.markFor(a))};for(n.s();!(i=n.n()).done;)a()}catch(e){n.e(e)}finally{n.f()}t.setSelection(r)}}},{key:"getSelectedParams",value:function getSelectedParams(){var e,t=this,i=[],r=_createForOfIteratorHelper(this.selection);try{var n=function _loop2(){var r=e.value,n=t.host.norm.series.find(function(e){return e.id===r.seriesId});if(!n)return 1;var a=t.resolver.buildActiveItem(n,r.dataIndex);a&&i.push(t.resolver.toParams(a))};for(r.s();!(e=r.n()).done;)n()}catch(e){r.e(e)}finally{r.f()}return i}},{key:"brushRect",get:function get(){return this.host.brush?this.host.brush.rect:null}},{key:"brushRange",value:function brushRange(){var e=this.brushRect,t=this.host.layout.plot;if(!e||e.width<2&&e.height<2)return null;var i=this.host.norm.option.interaction&&this.host.norm.option.interaction.brush,r=i&&i.axes||"x",n={};if("x"===r||"xy"===r){var a=this.valueAtPixel("x",e.x-t.x),o=this.valueAtPixel("x",e.x+e.width-t.x),s=this.orderValues("x",a,o);s&&(n.x=s)}if("y"===r||"xy"===r){var l=this.valueAtPixel("y",e.y-t.y),h=this.valueAtPixel("y",e.y+e.height-t.y),u=this.orderValues("y",l,h);u&&(n.y=u)}return n.x||n.y?n:null}},{key:"valueAtPixel",value:function valueAtPixel(e,t){var i=this.host.norm["x"===e?"xAxis":"yAxis"],r=i.scale;if(r){if(r.isBand()){var n=r.indexAt(t),a=n>=0?n:r.nearestIndex?r.nearestIndex(t):0;return i.domain[clamp$2(a,0,i.domain.length-1)]}return r.invert(t)}}},{key:"orderValues",value:function orderValues(e,t,i){if(void 0===t||void 0===i)return null;var r=this.host.norm["x"===e?"xAxis":"yAxis"].scale;if(r&&r.isBand()){var n=this.host.norm["x"===e?"xAxis":"yAxis"].domain;return n.indexOf(t)<=n.indexOf(i)?[t,i]:[i,t]}return Number(t)<=Number(i)?[t,i]:[i,t]}},{key:"applyRange",value:function applyRange(e){e.x&&this.host.setDomain("x",e.x,"brush"),e.y&&this.host.setDomain("y",e.y,"brush")}},{key:"handleWheel",value:function handleWheel(e,t,i,r){var n=this.host.norm.option.interaction&&this.host.norm.option.interaction.zoom;if(!n||!1===n||!1===n.enabled||!1===n.wheel)return!1;var a=this.resolveTarget(e,t);if(!this.resolver.isInsidePlot(a.chart[0],a.chart[1]))return!1;this.preventDefault(r);var o=Number(n.wheelFactor)||1.2,s=i<0?o:1/o;if("viewport"===n.mode)return this.host.ice.zoomAt(e,t,s),!0;var l=n.axes||"x",h=this.host.layout.plot;if("x"===l||"xy"===l){var u=this.zoomDomain("x",a.chart[0]-h.x,s);u&&this.host.setDomain("x",u,"zoom")}if("y"===l||"xy"===l){var c=this.zoomDomain("y",a.chart[1]-h.y,s);c&&this.host.setDomain("y",c,"zoom")}return!0}},{key:"zoomDomain",value:function zoomDomain(e,t,i){var r=this.host.norm["x"===e?"xAxis":"yAxis"],n=r.scale;if(!n)return null;var a=this.host.norm.option.interaction&&this.host.norm.option.interaction.zoom,o=Number(a&&a.minSpan)||.05,s=Number(a&&a.maxSpan)||1,l=this.host.fullDomain(e),h="x"===e?this.host.layout.plot.width:this.host.layout.plot.height;if(n.isBand()){var u=l,c=u.length;if(c<=2)return null;var d=r.domain,f=Math.max(0,u.indexOf(d[0])),p=u.indexOf(d[d.length-1]),v=Math.max(2,p-f+1),m=clamp$2(t/Math.max(1,h),0,1),g=Math.round(clamp$2(v/i,Math.max(2,Math.ceil(c*o)),Math.floor(c*s)));g=Math.min(g,c);var b=f+m*(v-1),k=Math.round(b-m*(g-1));return[u[k=clamp$2(k,0,Math.max(0,c-g))],u[k+g-1]]}var S=Number(r.domain[0]),w=Number(r.domain[1])-S,A=Number(l[1])-Number(l[0]),_=clamp$2(w/i,A*o,A*s),M=n.invert(t),C=M-(0===w?.5:(M-S)/w)*_;return[C,C+_]}},{key:"currentRange",value:function currentRange(){return{x:[this.host.norm.xAxis.domain[0],this.host.norm.xAxis.domain[1]],y:[Number(this.host.norm.yAxis.domain[0]),Number(this.host.norm.yAxis.domain[1])]}}},{key:"handleKeyDown",value:function handleKeyDown(e,t){var i=this.host.norm.option.interaction;if(i&&!1===i.keyboard)return!1;if(!e)return!1;if(ke&&ke!==this&&ke.host)return!1;if(t&&t.target&&/^(INPUT|TEXTAREA|SELECT)$/.test(t.target.tagName||""))return!1;var r=this.host.norm.series.filter(function(e){return!e.hidden});if(!r.length)return!1;var n=0;if(this.hover){var a="item"===this.hover.kind?this.hover.item.series.id:this.hover.column.items[0].series.id,o=r.findIndex(function(e){return e.id===a});o>=0&&(n=o)}var s=!1;switch(e){case"ArrowRight":case"ArrowLeft":var l=r[n];if(!l.points.length)break;var h=this.stepVisibleIndex(l,"ArrowRight"===e?1:-1);if(h>=0){this.keyboardIndex=h;var u=this.resolver.buildActiveItem(l,h);u&&this.setHover({kind:"item",item:u})}s=h>=0;break;case"ArrowUp":case"ArrowDown":var c=r[clamp$2(n+("ArrowDown"===e?1:-1),0,r.length-1)];if(!c.points.length)break;var d=clamp$2(this.keyboardIndex,0,c.points.length-1),f=this.resolver.buildActiveItem(c,d);f&&this.setHover({kind:"item",item:f}),s=!0;break;case"Escape":this.setHover(null),this.clearSelection(),this.host.brush&&this.host.brush.setRect(null),s=!0;break;case"Enter":case" ":if(this.hover&&"item"===this.hover.kind){var p=this.hover.item,v=i&&i.select;this.toggleSelection(p.series.id,p.point.index,v&&v.mode||"single",!0),this.host.emit("item:click",this.resolver.toParams(p)),s=!0}}return s&&this.preventDefault(t),s}},{key:"showHoverAtValue",value:function showHoverAtValue(e){var t=this.resolver.nearestByXValue(e);t&&this.setHover({kind:"item",item:t})}},{key:"clearHover",value:function clearHover(){this.setHover(null)}},{key:"seriesOfGraphComponent",value:function seriesOfGraphComponent(e){var t,i=_createForOfIteratorHelper(this.host.norm.series);try{for(i.s();!(t=i.n()).done;){var r=t.value;if(this.resolver.seriesComponentOf(r)===e)return r}}catch(e){i.e(e)}finally{i.f()}return null}},{key:"stepVisibleIndex",value:function stepVisibleIndex(e,t){var i=e.points.length;if(!i)return-1;for(var r=clamp$2(this.keyboardIndex,0,i-1),n=0;n<i;n++){var a=r+t;if(a<0||a>=i)return-1;r=a;var o=this.resolver.buildActiveItem(e,r);if(o&&this.resolver.isInsidePlot(o.pixel[0],o.pixel[1]))return r}return-1}},{key:"destroy",value:function destroy(){this.unbind(),ke===this&&(ke=null),this.host=null}}])}();var we=function(){return _createClass(function Emitter(){_classCallCheck(this,Emitter),_defineProperty(this,"listeners",new Map)},[{key:"on",value:function on(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.listeners.get(e)||[];return this.off(e,t,i),r.push({fn:t,scope:i}),this.listeners.set(e,r),this}},{key:"once",value:function once(e,t){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=function wrapper(a){i.off(e,n,r),t.call(r,a)};return n.__onceOriginal=t,this.on(e,n,r)}},{key:"off",value:function off(e,t,i){var r=this.listeners.get(e);if(!r)return this;if(!t)return this.listeners.delete(e),this;for(var n=r.length-1;n>=0;n--){var a=r[n],o=a.fn;!(o===t||o&&o.__onceOriginal===t)||void 0!==i&&a.scope!==i||r.splice(n,1)}return r.length||this.listeners.delete(e),this}},{key:"emit",value:function emit(e,t){var i=this.listeners.get(e);if(!i||!i.length)return!1;for(var r=i.slice(),n=0;n<r.length;n++)r[n].fn.call(r[n].scope,t);return!0}},{key:"hasListener",value:function hasListener(e){var t=this.listeners.get(e);return!!t&&t.length>0}},{key:"clear",value:function clear(){this.listeners.clear()}}])}();function chartTitle(e){var t=e.option.title&&e.option.title.text;return t?String(t):e.labels.chart}function buildDataTable(e){var t=e.norm,i=chartTitle(t),r=t.series.filter(function(e){return!e.hidden&&"pie"!==e.type});if("polar"===t.kind){var n=t.series.find(function(e){return"pie"===e.type});if(!n)return{caption:i,columns:[t.labels.sector,t.labels.value,t.labels.ratio],rows:[]};var a=n.points.filter(function(e){return!t.hiddenSlices["".concat(n.id,"#").concat(e.index)]}),o=a.reduce(function(e,t){return e+(t.y||0)},0);return{caption:i,columns:[t.labels.sector,t.labels.value,t.labels.ratio],rows:a.map(function(e){return[e.name||"".concat(n.name," ").concat(e.index+1),null===e.y?"":String(e.y),o>0?"".concat(((e.y||0)/o*100).toFixed(1),"%"):"0%"]})}}if("radar"===t.kind){var s=t.radar&&t.radar.indicators||[];return{caption:i,columns:["指标"].concat(_toConsumableArray(r.map(function(e){return e.name}))),rows:s.map(function(e,t){return[e.name].concat(_toConsumableArray(r.map(function(e){var i=e.points[t];return i&&null!==i.y?String(i.y):""})))})}}var l,h=[t.xAxis.option&&t.xAxis.option.name||"类目"].concat(_toConsumableArray(r.map(function(e){return e.name}))),u=[],c={},d=_createForOfIteratorHelper(r);try{for(d.s();!(l=d.n()).done;){var f,p=l.value,v=_createForOfIteratorHelper(p.points);try{for(v.s();!(f=v.n()).done;){var m=f.value,g=String(m.xValue);c[g]||(c[g]={x:m.xValue,cells:{}},u.push(g)),c[g].cells[p.id]=null===m.y?"":e.formatAxisValue("y",m.y)}}catch(e){v.e(e)}finally{v.f()}}}catch(e){d.e(e)}finally{d.f()}var b=u.map(function(t){var i=c[t];return[e.formatAxisValue("x",i.x)].concat(_toConsumableArray(r.map(function(e){return i.cells[e.id]||""})))});return{caption:i,columns:h,rows:b}}function buildDataNodes(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Math.max(0,void 0===i.maxDataNodesPerSeries?200:i.maxDataNodesPerSeries),n=[],a=_createForOfIteratorHelper(e.norm.series);try{for(a.s();!(t=a.n()).done;){var o=t.value;if(!o.hidden){var s=e.controller&&e.controller.resolver?e.controller.resolver.seriesComponentOf(o):null;if(s)for(var l=Math.min(o.points.length,r),h=0;h<l;h++){var u=o.points[h],c=s.pixelAt(h);if(c){var d=[e.layout.plot.x+c[0],e.layout.plot.y+c[1]],f=e.ice&&"function"==typeof e.ice.worldToScreen?e.ice.worldToScreen(d[0],d[1]):d,p=seriesSymbolSize(o);n.push({id:"".concat(o.id,"#").concat(h),role:"graphic",label:"".concat(o.name,",").concat(e.formatAxisValue("x",u.xValue),",").concat(null===u.y?"无数据":e.formatAxisValue("y",u.y)),seriesId:o.id,seriesName:o.name,dataIndex:h,value:u.y,box:{x:f[0]-p/2,y:f[1]-p/2,width:p,height:p},focusable:!0})}}}}}catch(e){a.e(e)}finally{a.f()}return n}function seriesSymbolSize(e){var t=e.option.symbolSize;return"number"==typeof t&&isFinite(t)?Math.max(8,t):"bar"===e.type?12:10}var Ae=["position:absolute","width:1px","height:1px","margin:-1px","padding:0","overflow:hidden","clip:rect(0 0 0 0)","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),_e=function(){function A11yMirror(e){_classCallCheck(this,A11yMirror),_defineProperty(this,"wrapper",null),_defineProperty(this,"live",null),_defineProperty(this,"tableEl",null),_defineProperty(this,"hoverHandler",null),this.chart=e}return _createClass(A11yMirror,[{key:"attached",get:function get(){return!!this.wrapper}},{key:"element",get:function get(){return this.wrapper}},{key:"attach",value:function attach(){var e=this,t=this.chart.ice,i=this.chart.canvasElement,r=t&&t.root&&t.root.document;if(!r||!i||"function"!=typeof r.createElement||!i.parentNode)return!1;this.detach();var n=r.createElement("div");n.id="ice-chart-a11y-mirror-".concat(++A11yMirror.seq),n.setAttribute("style",Ae),n.setAttribute("data-ice-chart-a11y","mirror"),this.tableEl=r.createElement("table");var a=r.createElement("div");return a.setAttribute("role","status"),a.setAttribute("aria-live","polite"),n.appendChild(this.tableEl),n.appendChild(a),i.parentNode.appendChild(n),i.setAttribute("aria-describedby",n.id),i.getAttribute("aria-label")||i.setAttribute("aria-label",chartTitle(this.chart.norm)),this.wrapper=n,this.live=a,this.refresh(),this.hoverHandler=function(t){t&&e.announce("".concat(t.seriesName,",").concat(e.chart.formatAxisValue("x",t.xValue),",").concat(null===t.value?"无数据":e.chart.formatAxisValue("y",t.value)))},this.chart.on("item:hover",this.hoverHandler),!0}},{key:"detach",value:function detach(){this.hoverHandler&&(this.chart.off("item:hover",this.hoverHandler),this.hoverHandler=null);var e=this.chart.canvasElement;this.wrapper&&this.wrapper.parentNode&&this.wrapper.parentNode.removeChild(this.wrapper),e&&"function"==typeof e.removeAttribute&&e.removeAttribute("aria-describedby"),this.wrapper=null,this.live=null,this.tableEl=null}},{key:"refresh",value:function refresh(){var e=this.chart.ice&&this.chart.ice.root&&this.chart.ice.root.document;if(this.wrapper&&this.tableEl&&e){for(var t=buildDataTable(this.chart);this.tableEl.firstChild;)this.tableEl.removeChild(this.tableEl.firstChild);var i=e.createElement("caption");i.textContent=t.caption,this.tableEl.appendChild(i);var r,n=e.createElement("thead"),a=e.createElement("tr"),o=_createForOfIteratorHelper(t.columns);try{for(o.s();!(r=o.n()).done;){var s=r.value,l=e.createElement("th");l.setAttribute("scope","col"),l.textContent=s,a.appendChild(l)}}catch(e){o.e(e)}finally{o.f()}n.appendChild(a),this.tableEl.appendChild(n);var h,u=e.createElement("tbody"),c=_createForOfIteratorHelper(t.rows);try{for(c.s();!(h=c.n()).done;){for(var d=h.value,f=e.createElement("tr"),p=0;p<d.length;p++){var v=e.createElement(0===p?"th":"td");0===p&&v.setAttribute("scope","row"),v.textContent=d[p],f.appendChild(v)}u.appendChild(f)}}catch(e){c.e(e)}finally{c.f()}this.tableEl.appendChild(u)}}},{key:"announce",value:function announce(e){this.live&&(this.live.textContent=e)}}])}();_defineProperty(_e,"seq",0);function layoutTreemap(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,a=[],o=Math.max(0,Number(r.gap)||2),s=void 0===r.depthFade?.18:Math.max(0,Math.min(1,Number(r.depthFade)));if(!Array.isArray(e)||!e.length)return a;var l=sumValues(e);if(!(l>0))return a;var h=0,u=function visit(e,t,i,r,n){if(!(t.width<=1||t.height<=1)){var c=e.map(function(e){return{node:e,value:nodeValue(e)}}).filter(function(e){return e.value>0});if(c.length){c.sort(function(e,t){return t.value-e.value});for(var d=c.reduce(function(e,t){return e+t.value},0),f=function squarify(e,t,i){var r=[],n=_objectSpread2({},t),a=e.slice(),o=t.width*t.height/i;if(!(o>0))return r;for(;a.length;){var s=Math.min(n.width,n.height);if(!(s>0))break;for(var l=[],h=0;a.length;){var u=a[0],c=h+u.value*o,d=l.length?worstRatio(l,h,s):1/0,f=worstRatio([].concat(l,[u]),c,s);if(l.length&&f>d)break;l.push(a.shift()),h=c}for(var p=n.width>=n.height,v=h/s,m=0,g=0,b=l;g<b.length;g++){var k=b[g],S=k.value*o/v,w=p?{x:n.x,y:n.y+m,width:v,height:S}:{x:n.x+m,y:n.y,width:S,height:v};r.push({item:k,box:w}),m+=S}n=p?{x:n.x+v,y:n.y,width:Math.max(0,n.width-v),height:n.height}:{x:n.x,y:n.y+v,width:n.width,height:Math.max(0,n.height-v)}}return r}(c,t,d),p=0;p<f.length;p++){var v=f[p],m=v.item,g=v.box,b=m.node.color||shade(n,i*s),k=Array.isArray(m.node.children)?m.node.children:[],S=k.length>0,w=h++,A=S&&g.height>32?16:0;if(a.push({id:w,name:m.node.name,depth:i,parent:r,value:m.value,ratio:m.value/l,rect:g,header:A,color:b,hasChildren:S}),S){var _={x:g.x+o,y:g.y+o+A,width:Math.max(0,g.width-2*o),height:Math.max(0,g.height-2*o-A)};u(k,_,i+1,w,b)}}}}};return u(e,i,0,-1,n[0]),a.filter(function(e){return 0===e.depth}).forEach(function(e,t){var i=n[t%n.length];e.color=i,recolor(a,e.id,i,n,s)}),a}function recolor(e,t,i,r,n){var a,o=_createForOfIteratorHelper(e);try{for(o.s();!(a=o.n()).done;){var s=a.value;s.parent===t&&(s.color=shade(i,s.depth*n),recolor(e,s.id,s.color,r,n))}}catch(e){o.e(e)}finally{o.f()}}function sumValues(e){var t,i=0,r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){i+=nodeValue(t.value)}}catch(e){r.e(e)}finally{r.f()}return i}function nodeValue(e){if(Array.isArray(e.children)&&e.children.length)return sumValues(e.children);var t=Number(e.value);return isFinite(t)&&t>0?t:0}function worstRatio(e,t,i){if(!(t>0&&i>0))return 1/0;var r,n=0,a=1/0,o=_createForOfIteratorHelper(e);try{for(o.s();!(r=o.n()).done;){var s=r.value;s.value>n&&(n=s.value),s.value<a&&(a=s.value)}}catch(e){o.e(e)}finally{o.f()}if(!(a>0))return 1/0;var l=t,h=i;return Math.max(h*h*n/(l*l),l*l/(h*h*a))}function shade(e,t){var i=function parseHex(e){if("string"!=typeof e)return null;var t=e.trim();if(0===t.indexOf("#"))return 3===(t=t.slice(1)).length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?null:[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];var i=t.match(/rgba?\(([^)]+)\)/);if(i){var r=i[1].split(",").map(function(e){return parseFloat(e)});return[r[0]||0,r[1]||0,r[2]||0]}return null}(e);if(!i)return e;var r=Math.max(0,Math.min(1,t)),n=Math.round(i[0]+(255-i[0])*r),a=Math.round(i[1]+(255-i[1])*r),o=Math.round(i[2]+(255-i[2])*r);return"rgb(".concat(n,",").concat(a,",").concat(o,")")}var Me=10,Ce=20,Te=100,Pe=300,Fe=310,Ie=400,Oe=450,Ne=500,De=600,He=620,Re=640,Ee=700;function isChartSnapshot(e){return!!e&&"object"===_typeof(e)&&!Array.isArray(e)&&!!e.option&&("version"in e||"view"in e||"hidden"in e)}function mergeOptionPatch(e,t){var i=_objectSpread2(_objectSpread2({},e),t);return Array.isArray(t&&t.series)&&Array.isArray(e&&e.series)&&(i.series=e.series.map(function(e,i){var r=t.series.find(function(t){return t&&t.id&&e&&e.id&&t.id===e.id}),n=t.series[i],a=r||(n&&!n.id?n:void 0);return a?_objectSpread2(_objectSpread2({},e),a):e})),i}var Le=function(){function ICEChart(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(_classCallCheck(this,ICEChart),_defineProperty(this,"axisYList",[]),_defineProperty(this,"legend",null),_defineProperty(this,"titleComponent",null),_defineProperty(this,"tooltip",null),_defineProperty(this,"crosshair",null),_defineProperty(this,"highlight",null),_defineProperty(this,"brushComponent",null),_defineProperty(this,"dataZoomSlider",null),_defineProperty(this,"seriesComponents",[]),_defineProperty(this,"markLayer",null),_defineProperty(this,"marks",[]),_defineProperty(this,"markSeq",0),_defineProperty(this,"syncingMarks",!1),_defineProperty(this,"fullXDomain",[]),_defineProperty(this,"fullYDomain",[]),_defineProperty(this,"fullYDomains",[]),_defineProperty(this,"emitter",new we),_defineProperty(this,"viewState",{x:null,y:null,yAxes:[]}),_defineProperty(this,"autoYCurve",!1),_defineProperty(this,"hiddenIds",{}),_defineProperty(this,"hiddenSlices",{}),_defineProperty(this,"seriesSignature",""),_defineProperty(this,"axisSignature",""),_defineProperty(this,"resizeObserver",null),_defineProperty(this,"destroyed",!1),_defineProperty(this,"silenceDepth",0),_defineProperty(this,"__appliedEngineThemeKey",null),_defineProperty(this,"a11yMirror",new _e(this)),_defineProperty(this,"domainTransition",null),_defineProperty(this,"domainFrameHandler",null),!t)throw new Error("[ice-chart] 初始化失败:缺少 canvas 元素或其 id。");this.chartOptions=r,this.option=i,this.ice=new e.ICE,this.ice.init(t,{renderMode:r.renderMode||"dirty-rect",dpr:r.dpr}),this.canvasEl=this.ice.canvasEl||t,this.registerTypes();var n=this.canvasRect();this.root=new e.ICEGroup({left:0,top:0,width:n.width,height:n.height,origin:"top-left",fill:!1,stroke:!1,interactive:!1,draggable:!1,transformable:!1,linkable:!1,clipChildren:!0,zIndex:0}),this.ice.addChild(this.root),this.plotArea=new E({left:0,top:0,width:1,height:1,zIndex:Me}),this.grid=new D({width:n.width,height:n.height,zIndex:Ce}),this.annotation=new R({width:n.width,height:n.height,zIndex:Fe}),this.radarGrid=new U({width:n.width,height:n.height,zIndex:Ce+5}),this.polarGrid=new X({width:n.width,height:n.height,zIndex:Ce+6}),this.axisX=new N({orientation:"x",width:n.width,height:n.height,zIndex:Ie}),this.axisYList=[new N({orientation:"y",width:n.width,height:n.height,zIndex:Ie,axisIndex:0,position:"left"})],this.legend=new L({width:n.width,height:n.height,zIndex:Ne}),this.titleComponent=new z({width:n.width,height:n.height,zIndex:Oe}),this.crosshair=new W({width:n.width,height:n.height,zIndex:De}),this.highlight=new V({width:n.width,height:n.height,zIndex:He}),this.brushComponent=new j({width:n.width,height:n.height,zIndex:Re}),this.dataZoomSlider=new K({left:0,top:0,width:n.width,height:26,zIndex:Re+5}),this.tooltip=new B({width:n.width,height:n.height,zIndex:Ee}),this.root.addChildren([this.plotArea,this.grid,this.annotation,this.radarGrid,this.polarGrid,this.axisX].concat(_toConsumableArray(this.axisYList),[this.titleComponent,this.legend,this.crosshair,this.highlight,this.brushComponent,this.dataZoomSlider,this.tooltip])),this.controller=new Se(this),this.applyOption(i,{animate:"enter",preserveView:!1}),this.controller.bind(),r.autoResize&&this.observeResize()}return _createClass(ICEChart,[{key:"brush",get:function get(){return this.brushComponent}},{key:"setOption",value:function setOption(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.applyOption(e,{animate:void 0===t.animate||t.animate,preserveView:!1!==t.preserveView}),this}},{key:"getOption",value:function getOption(){return this.option}},{key:"expressionDiagnostics",value:function expressionDiagnostics(){var e,t=[],i=_createForOfIteratorHelper(this.norm.series);try{for(i.s();!(e=i.n()).done;){var r=e.value;r.expressionDiagnostics&&r.expressionDiagnostics.length&&t.push({seriesId:r.id,diagnostics:r.expressionDiagnostics})}}catch(e){i.e(e)}finally{i.f()}return t}},{key:"expressionErrors",value:function expressionErrors(){var e,t=[],i=_createForOfIteratorHelper(this.norm.series);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(r.expressionDiagnostics){var n,a=_createForOfIteratorHelper(r.expressionDiagnostics);try{for(a.s();!(n=a.n()).done;){var o=n.value;"error"===o.severity&&t.push({seriesId:r.id,message:o.message})}}catch(e){a.e(e)}finally{a.f()}}}}catch(e){i.e(e)}finally{i.f()}return t}},{key:"annotationDiagnostics",value:function annotationDiagnostics(){return this.annotation?this.annotation.diagnostics.slice():[]}},{key:"annotationErrors",value:function annotationErrors(){return this.annotationDiagnostics().filter(function(e){return"error"===e.severity})}},{key:"setData",value:function setData(e,t){var i=(this.option.series||[]).map(function(e,t){return{item:e,index:t}}).find(function(t){return"number"==typeof e?t.index===e:t.item.id===e||t.item.name===e});if(!i)throw new Error("[ice-chart] 找不到系列:".concat(e));return i.item.data=t,this.applyOption(this.option,{animate:!0,preserveView:!0}),this.emit("data:change",{seriesId:i.item.id,seriesIndex:i.index}),this}},{key:"appendData",value:function appendData(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null==e)throw new Error("[ice-chart] appendData 需要系列 id / name / 下标。");var r=(this.option.series||[]).map(function(e,t){return{item:e,index:t}}).find(function(t){return"number"==typeof e?t.index===e:t.item.id===e||t.item.name===e});if(!r)throw new Error("[ice-chart] 找不到系列:".concat(e));var n=Array.isArray(t)?t:[];if(!n.length)return this;var a=(r.item.data||[]).concat(n),o=Number(i.maxPoints);return r.item.data=isFinite(o)&&o>0&&a.length>o?a.slice(a.length-o):a,this.applyOption(this.option,{animate:!0===i.animate,preserveView:!0}),this.emit("data:change",{seriesId:r.item.id,seriesIndex:r.index}),this}},{key:"setDomain",value:function setDomain(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"api";if(this.destroyed)return this;var r="x"!==e||"zoom"!==i&&"brush"!==i?t:this.guardInteractiveXWindow(t),n=this.clampDomain(e,r);if(!n)return this;"x"===e?this.viewState.x=n:this.viewState.y=n,this.rebuild(!1);var a=this.currentRange();return this.emit("pan"===i?"pan:change":"zoom:change",a),this}},{key:"numericXValues",value:function numericXValues(){var e,t=new Set,i=_createForOfIteratorHelper(this.norm.series);try{for(i.s();!(e=i.n()).done;){var r,n=_createForOfIteratorHelper(e.value.points);try{for(n.s();!(r=n.n()).done;){var a=r.value,o=Number(a.xValue);isFinite(o)&&t.add(o)}}catch(e){n.e(e)}finally{n.f()}}}catch(e){i.e(e)}finally{i.f()}return _toConsumableArray(t).sort(function(e,t){return e-t})}},{key:"guardInteractiveXWindow",value:function guardInteractiveXWindow(e){if("category"===this.norm.xAxis.type){var t=this.fullXDomain;if(t.length<2)return e;var i=t.indexOf(e[0]),r=t.indexOf(e[1]);return i<0&&r<0?e:(i<0&&(i=0),r<0&&(r=t.length-1),r-i>=1?e:(i>0?i-=1:r<t.length-1&&(r+=1),[t[i],t[r]]))}var n=this.numericXValues();if(n.length<2)return e;var a=n.length>=3?2:1,o=Number(e[0]),s=Number(e[1]);if(!isFinite(o)||!isFinite(s)||s<=o)return e;for(var l=n.filter(function(e){return e>=o&&e<=s}).length,h=0;l<a&&h<4;){h+=1;var u=_toConsumableArray(n).reverse().find(function(e){return e<o}),c=n.find(function(e){return e>s});if(void 0===u&&void 0===c)break;(void 0===u?1/0:o-u)<=(void 0===c?1/0:c-s)?o=u:s=c,l=n.filter(function(e){return e>=o&&e<=s}).length}return l>=a?[o,s]:e}},{key:"addMark",value:function addMark(e){var t=this,i=e.id||"mark-".concat(++this.markSeq);if(this.marks.some(function(e){return e.id===i}))throw new Error("[ice-chart] addMark:id「".concat(i,"」已经存在"));if(!e||!e.component)throw new Error("[ice-chart] addMark:必须提供 component(一个引擎图元实例)");var r=e.type||"point";if("point"!==r&&"xLine"!==r&&"yLine"!==r&&"xBand"!==r&&"yBand"!==r)throw new Error("[ice-chart] addMark:不支持的 type「".concat(String(r),"」"));var n={id:i,spec:_objectSpread2(_objectSpread2({},e),{},{id:i}),component:e.component,dragging:!1};return this.marks.push(n),this.ensureMarkLayer().addChild(e.component),"function"==typeof e.component.on&&e.component.on("AFTER_MOVE",function(e){if(!t.syncingMarks){var i=e&&isFinite(e.left)&&isFinite(e.top)?{left:Number(e.left),top:Number(e.top)}:void 0,a=t.markDataAt(n,i);"point"===r?(n.spec.x=a.xValue,n.spec.y=a.yValue):"xLine"===r||"xBand"===r?"xLine"===r?n.spec.x=a.xValue:n.spec.x0=a.xValue:"yLine"===r?n.spec.y=a.yValue:n.spec.y0=a.yValue,n.dragging=!0,t.syncMarks(),t.emit("mark:drag",a),"function"==typeof n.spec.onDrag&&n.spec.onDrag(a)}}),this.syncMarks(),this.markHandle(n)}},{key:"getMark",value:function getMark(e){var t=this.marks.find(function(t){return t.id===e});return t?this.markHandle(t):null}},{key:"getMarks",value:function getMarks(){var e=this;return this.marks.map(function(t){return e.markHandle(t)})}},{key:"removeMark",value:function removeMark(e){var t=this.marks.findIndex(function(t){return t.id===e});if(t<0)return!1;var i=_slicedToArray(this.marks.splice(t,1),1)[0];return this.markLayer&&i.component&&this.markLayer.removeChild(i.component),!0}},{key:"clearMarks",value:function clearMarks(){var e,t=_createForOfIteratorHelper(this.marks);try{for(t.s();!(e=t.n()).done;){var i=e.value;this.markLayer&&i.component&&this.markLayer.removeChild(i.component)}}catch(e){t.e(e)}finally{t.f()}this.marks=[]}},{key:"isMarkComponent",value:function isMarkComponent(e){return!!e&&this.marks.some(function(t){return t.component===e})}},{key:"finishMarkDrag",value:function finishMarkDrag(){var e,t=_createForOfIteratorHelper(this.marks);try{for(t.s();!(e=t.n()).done;){var i=e.value;i.dragging&&(i.dragging=!1,this.emit("mark:dragend",this.markDataAt(i)))}}catch(e){t.e(e)}finally{t.f()}}},{key:"ensureMarkLayer",value:function ensureMarkLayer(){if(this.markLayer)return this.markLayer;var t=this.layout?this.layout.canvas:this.canvasRect(),i=new e.ICEGroup({left:0,top:0,width:t.width,height:t.height,origin:"top-left",fill:!1,stroke:!1,interactive:!1,draggable:!1,transformable:!1,linkable:!1,zIndex:Pe});return this.root.addChild(i),this.markLayer=i,i}},{key:"markHandle",value:function markHandle(e){var t=this,i={id:e.id,spec:e.spec,component:e.component,update:function update(r){return Object.assign(e.spec,r),t.syncMarks(),i},toData:function toData(){return t.markDataAt(e)},remove:function remove(){t.removeMark(e.id)}};return i}},{key:"markAxis",value:function markAxis(e){if(e.seriesId){var t=this.norm.series.find(function(t){return t.id===e.seriesId||t.name===e.seriesId});if(t)return this.norm.yAxes[t.axisIndex]||this.norm.yAxis}return this.norm.yAxes[0]||this.norm.yAxis}},{key:"markBox",value:function markBox(e,t){var i=e.type||"point",r=this.layout.plot,n=this.norm.xAxis.scale,a=this.markAxis(e),o=a&&a.scale,s=Number(e.dx)||0,l=Number(e.dy)||0,h=function px(e){return r.x+Number(n.map(e))+s},u=function py(e){return r.y+Number(o.map(e))+l},c=t.width||1,d=t.height||1;if("xLine"===i)return{left:h(e.x)-c/2,top:r.y+l,width:c,height:r.height};if("yLine"===i)return{left:r.x+s,top:u(e.y)-d/2,width:r.width,height:d};if("xBand"===i){var f=h(e.x0),p=h(e.x1);return{left:Math.min(f,p),top:r.y+l,width:Math.abs(p-f),height:r.height}}if("yBand"===i){var v=u(e.y0),m=u(e.y1);return{left:r.x+s,top:Math.min(v,m),width:r.width,height:Math.abs(m-v)}}var g=h(e.x),b=u(e.y);return{left:g-c/2,top:b-d/2,width:c,height:d,anchor:[g,b]}}},{key:"markDataAt",value:function markDataAt(e,t){var i,r,n=e.spec,a=n.type||"point",o=this.layout.plot,s=this.norm.xAxis.scale,l=this.markAxis(n),h=l&&l.scale,u=e.component.state||{},c=u.width||0,d=u.height||0,f=t?t.left:u.left,p=t?t.top:u.top;"point"===a?(i=f+c/2,r=p+d/2):"xLine"===a||"xBand"===a?(i=f+c/2,r=o.y+o.height/2):(i=o.x+o.width/2,r=p+d/2);var v=s&&"function"==typeof s.invert?s.invert(i-o.x):null,m=h&&"function"==typeof h.invert?Number(h.invert(r-o.y)):NaN;return{id:e.id,xValue:v,yValue:"xLine"!==a&&"xBand"!==a&&isFinite(m)?m:void 0,pixel:[i,r]}}},{key:"syncMarks",value:function syncMarks(){if(this.marks.length&&this.norm&&this.layout){var e=this.layout.plot;this.syncingMarks=!0;try{var t,i=_createForOfIteratorHelper(this.marks);try{for(i.s();!(t=i.n()).done;){var r=t.value,n=r.component.state||{},a=this.markBox(r.spec,{width:n.width||0,height:n.height||0});if([a.left,a.top,a.width,a.height].every(function(e){return isFinite(e)})){var o=!1!==r.spec.hideWhenOutOfView,s=a.anchor||[a.left+a.width/2,a.top+a.height/2],l=!(isFinite(s[0])&&isFinite(s[1]))||s[0]<e.x-a.width||s[0]>e.x+e.width+a.width||s[1]<e.y-a.height||s[1]>e.y+e.height+a.height,h=Math.round(a.left),u=Math.round(a.top),c=Math.max(1,Math.round(a.width)),d=Math.max(1,Math.round(a.height));n.left===h&&n.top===u||(r.component.setPosition(h,u),!0),n.width===c&&n.height===d||(r.component.setState({width:c,height:d}),!0),r.component.setState({display:!o||!l})}else r.component.setState({display:!1})}}catch(e){i.e(e)}finally{i.f()}}finally{this.syncingMarks=!1}this.markLayer&&this.markLayer.setState({width:this.layout.canvas.width,height:this.layout.canvas.height})}}},{key:"resetZoom",value:function resetZoom(){return this.viewState={x:null,y:null,yAxes:[]},this.rebuild(!0),this.emit("zoom:change",this.currentRange()),this}},{key:"toggleSeries",value:function toggleSeries(e,t){var i=this.norm.series.find(function(t){return t.id===e});if(!i)return this;var r=!!this.hiddenIds[e],n=void 0===t?!r:!t;return this.hiddenIds[e]=n,this.applyOption(this.option,{animate:!0,preserveView:!0}),this.emit("legend:toggle",{seriesId:e,seriesName:i.name,seriesIndex:i.index,selected:!n}),this}},{key:"isSeriesSelected",value:function isSeriesSelected(e){return!this.hiddenIds[e]}},{key:"toggleSlice",value:function toggleSlice(e,t,i){var r=this.norm.series.find(function(t){return t.id===e});if(!r||"pie"!==r.type&&"funnel"!==r.type)return this;var n="".concat(e,"#").concat(t),a=!!this.hiddenSlices[n],o=void 0===i?!a:!i;this.hiddenSlices[n]=o;var s=r.points[t];return this.applyOption(this.option,{animate:!0,preserveView:!0}),this.emit("legend:toggle",{seriesId:e,seriesName:s&&s.name||"".concat(r.name," ").concat(t+1),seriesIndex:r.index,selected:!o,dataIndex:t}),this}},{key:"showHoverAt",value:function showHoverAt(e,t){var i=this.norm.series.find(function(t){return t.id===e});if(!i)return this;var r=this.controller.resolver.buildActiveItem(i,t);return r&&this.controller.setHover({kind:"item",item:r}),this}},{key:"showHoverAtValue",value:function showHoverAtValue(e){return this.controller.showHoverAtValue(e),this}},{key:"clearHover",value:function clearHover(){return this.controller.clearHover(),this}},{key:"getSelection",value:function getSelection(){return this.controller.getSelectedParams()}},{key:"clearSelection",value:function clearSelection(){return this.controller.clearSelection(),this}},{key:"getDomain",value:function getDomain(e){return"x"===e?this.norm.xAxis.domain.slice():this.norm.yAxis.domain.slice()}},{key:"getAxisDomain",value:function getAxisDomain(e){var t=this.norm.yAxes[e];return t?t.domain.slice():this.norm.yAxis.domain.slice()}},{key:"setAxisDomain",value:function setAxisDomain(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"api";if(0===e)return this.setDomain("y",t,i);if(this.destroyed)return this;var r=this.clampAxisDomain(e,t);return r?(this.viewState.yAxes[e]=r,this.rebuild(!1),this.emit("pan"===i?"pan:change":"zoom:change",this.currentRange()),this):this}},{key:"fullDomain",value:function fullDomain(e){return("x"===e?this.fullXDomain:this.fullYDomain).slice()}},{key:"canvasElement",get:function get(){return this.canvasEl}},{key:"getDataTable",value:function getDataTable(){return buildDataTable(this)}},{key:"getA11yTree",value:function getA11yTree(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="function"==typeof this.ice.getAccessibilityTree?this.ice.getAccessibilityTree():[];return[].concat(_toConsumableArray(t),_toConsumableArray(buildDataNodes(this,e)))}},{key:"attachA11yMirror",value:function attachA11yMirror(){return this.a11yMirror.attach()}},{key:"detachA11yMirror",value:function detachA11yMirror(){this.a11yMirror.detach()}},{key:"a11yMirrorAttached",get:function get(){return this.a11yMirror.attached}},{key:"announceA11y",value:function announceA11y(e){this.a11yMirror.announce(e)}},{key:"on",value:function on(e,t,i){return this.emitter.on(e,t,i),this}},{key:"once",value:function once(e,t,i){return this.emitter.once(e,t,i),this}},{key:"off",value:function off(e,t,i){return this.emitter.off(e,t,i),this}},{key:"emit",value:function emit(e,t){return!(this.silenceDepth>0)&&this.emitter.emit(e,t)}},{key:"silent",value:function silent(e){this.silenceDepth++;try{return e()}finally{this.silenceDepth--}}},{key:"resize",value:function resize(e,t){if(this.destroyed)return this;var i=this.ice.dpr||1,r=this.canvasEl,n=e,a=t;if(void 0===n||void 0===a){var o=r&&"function"==typeof r.getBoundingClientRect?r.getBoundingClientRect():null;n=o&&o.width||r.width/i,a=o&&o.height||r.height/i}var s=Number(n),l=Number(a);return s>0&&l>0?(r.width=Math.round(s*i),r.height=Math.round(l*i),r.style&&(r.style.width="".concat(s,"px"),r.style.height="".concat(l,"px")),this.ice.canvasWidth=r.width,this.ice.canvasHeight=r.height,"function"==typeof this.ice.updateCanvasBoundingRect&&this.ice.updateCanvasBoundingRect(),this.rebuild(!1),this):this}},{key:"destroy",value:function destroy(){this.destroyed||(this.destroyed=!0,this.stopDomainTransition(),this.a11yMirror.detach(),this.controller.destroy(),this.resizeObserver&&"function"==typeof this.resizeObserver.disconnect&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.emitter.clear(),this.ice.destroy())}},{key:"nextFrame",value:function nextFrame(){var e=this;return new Promise(function(t){var i=e.ice.evtBus;if(i){var r=function handler(){i.off("ROUND_FINISH",r,null),t()};i.on("ROUND_FINISH",r,null),e.ice.dirty=!0}else t()})}},{key:"render",value:function render(){return this.ice.dirty=!0,this.nextFrame()}},{key:"formatAxisValue",value:function formatAxisValue(e,t){var i="x"===e?this.norm.xAxis:this.norm.yAxis,r=i.scale;if(!r)return String(t);var n=i.domain.indexOf(t);return formatTick(t,r,n<0?0:n,i.option.formatter)}},{key:"toDataURL",value:function toDataURL(e,t){return this.ice&&"function"==typeof this.ice.toDataURL?this.ice.toDataURL(e,t):""}},{key:"toBlob",value:function toBlob(e,t,i){this.ice&&"function"==typeof this.ice.toBlob?this.ice.toBlob(e,t,i):e(null)}},{key:"toJSON",value:function toJSON(){return{version:1,option:toSerializableOption(this.option),view:{x:this.viewState.x,y:this.viewState.y,yAxes:this.viewState.yAxes},hidden:_objectSpread2({},this.hiddenIds),hiddenSlices:_objectSpread2({},this.hiddenSlices)}}},{key:"toJSONString",value:function toJSONString(){return JSON.stringify(this.toJSON())}},{key:"fromJSONString",value:function fromJSONString(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=JSON.parse(e);return this.loadSnapshot(i,t),this}},{key:"fromJSONObject",value:function fromJSONObject(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.loadSnapshot(e,t),this}},{key:"loadSnapshot",value:function loadSnapshot(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){var i="string"==typeof e?JSON.parse(e):e,r=i.option||i;if("number"==typeof i.version&&i.version>1)throw new Error("[ice-chart] 快照版本 ".concat(i.version," 高于当前实现支持的 ").concat(1,",请升级 ice-chart 后再还原。"));var n=t.optionPatch?mergeOptionPatch(r,t.optionPatch):r;this.hiddenIds=i.hidden||{},this.hiddenSlices=i.hiddenSlices||{};var a=i.view||{};this.viewState={x:a.x||null,y:a.y||null,yAxes:a.yAxes||[]},this.applyOption(n,{animate:!1,preserveView:!0})}}},{key:"applyOption",value:function applyOption(e,t){this.option=e;var i=this.norm?this.norm.yAxis.domain.slice():null,r=normalizeOption(e,{hiddenIds:this.hiddenIds,hiddenSlices:this.hiddenSlices,preferDark:isEngineThemeDark(this.ice)});if("auto"!==e.theme){var n=JSON.stringify(r.theme);n!==this.__appliedEngineThemeKey&&(applyChartThemeToEngine(this.ice,r.theme),this.__appliedEngineThemeKey=n)}if(this.fullXDomain=r.xAxis.domain.slice(),this.fullYDomain=r.yAxis.domain.slice(),this.fullYDomains=r.yAxes.map(function(e){return e.domain.slice()}),this.autoYCurve=(e.series||[]).some(function(e){return!!e&&"function"===e.type}),!t.preserveView){this.viewState={x:null,y:null,yAxes:[]};var a=this.initialWindow(r);a&&(this.viewState.x=a)}if(this.hiddenIds=r.hiddenIds,this.hiddenSlices=r.hiddenSlices,this.rebuild("enter"===t.animate?"enter":!1!==t.animate&&"update"),"update"===("enter"===t.animate?"enter":!1!==t.animate&&"update")&&shouldAnimate()&&i&&this.norm&&"cartesian"===this.norm.kind&&2===this.norm.yAxis.domain.length){var o=this.norm.yAxis.domain;(Math.abs(Number(i[0])-Number(o[0]))>1e-9||Math.abs(Number(i[1])-Number(o[1]))>1e-9)&&this.startDomainTransition([Number(i[0]),Number(i[1])],[Number(o[0]),Number(o[1])])}}},{key:"initialWindow",value:function initialWindow(e){var t=e.option.dataZoom;if(!t||void 0===t.start&&void 0===t.end)return null;var i=clamp$2(Number(void 0===t.start?0:t.start)/100,0,1),r=clamp$2(Number(void 0===t.end?100:t.end)/100,0,1);if(i<=0&&r>=1)return null;var n=e.xAxis.domain;if("category"===e.xAxis.type){var a=n.length,o=clamp$2(Math.floor(i*a),0,Math.max(0,a-2)),s=clamp$2(Math.ceil(r*a)-1,o+1,a-1);return[n[o],n[s]]}var l=Number(n[0]),h=Number(n[1])-l;return[l+h*i,l+h*r]}},{key:"startDomainTransition",value:function startDomainTransition(e,t){var i=this;if(this.domainTransition={from:e,to:t},!this.domainFrameHandler){var r=this.ice.evtBus;r&&(this.domainFrameHandler=function(){return i.stepDomainTransition()},r.on("ICE_FRAME_EVENT",this.domainFrameHandler,this))}}},{key:"stepDomainTransition",value:function stepDomainTransition(){var e=this.domainTransition;if(e&&!this.destroyed){var t,i=0,r=_createForOfIteratorHelper(this.seriesComponents);try{for(r.s();!(t=r.n()).done;){var n=t.value,a=Number(n.state.progress);isFinite(a)&&a>i&&(i=a)}}catch(e){r.e(e)}finally{r.f()}if(i>=1)return this.domainTransition=null,this.stopDomainTransition(),void this.rebuild(!1);var o=e.to.map(function(t,r){var n=e.from[r];return isFinite(n)?n+(t-n)*i:t});this.rebuild(!1,o)}else this.stopDomainTransition()}},{key:"stopDomainTransition",value:function stopDomainTransition(){if(this.domainFrameHandler){var e=this.ice&&this.ice.evtBus;e&&e.off("ICE_FRAME_EVENT",this.domainFrameHandler,this),this.domainFrameHandler=null}}},{key:"rebuild",value:function rebuild(e,t){var i=this;if(!this.destroyed){var r=this.canvasRect(),n=this.viewState.x||this.fullXDomain,a=this.fullYDomains.map(function(e,t){var r=0===t?i.viewState.y:i.viewState.yAxes[t];return r&&2===r.length?r:e}),o=normalizeOption(this.option,{hiddenIds:this.hiddenIds,hiddenSlices:this.hiddenSlices,preferDark:isEngineThemeDark(this.ice),xDomain:n&&2===n.length?[n[0],n[1]]:null,yDomain:!this.autoYCurve||this.viewState.y||t&&2===t.length?t&&2===t.length?[Number(t[0]),Number(t[1])]:a[0]&&2===a[0].length?[Number(a[0][0]),Number(a[0][1])]:null:null,yDomains:a.map(function(e){return(!i.autoYCurve||i.viewState.y||t&&2===t.length)&&e&&2===e.length?[Number(e[0]),Number(e[1])]:null})});this.norm=o,this.autoYCurve&&(this.fullYDomain=o.yAxis.domain.slice(),this.fullYDomains=o.yAxes.map(function(e){return e.domain.slice()})),this.layout=computeLayout(o,this.ice.ctx,r),this.buildScales(o),this.root.state.ariaLabel=chartTitle(o),this.syncComponents(!t&&e),this.syncMarks(),this.ice.dirty=!0,this.controller&&this.controller.refreshHover(),this.a11yMirror.attached&&this.a11yMirror.refresh()}}},{key:"buildScales",value:function buildScales(e){var t=this.layout.plot;e.xAxis.scale=createScale(e.xAxis.type,e.xAxis.domain,[0,Math.max(1,t.width)],{logBase:e.xAxis.option.logBase});var i,r=_createForOfIteratorHelper(e.yAxes);try{for(r.s();!(i=r.n()).done;){var n=i.value;n.scale=createScale(n.type,n.domain,[Math.max(1,t.height),0],{logBase:n.option.logBase})}}catch(e){r.e(e)}finally{r.f()}}},{key:"syncComponents",value:function syncComponents(e){var t=this.norm,i=this.layout,r=i.canvas,n=i.plot,a=t.theme;this.root.state.width===r.width&&this.root.state.height===r.height||this.root.setState({width:r.width,height:r.height});var o=i.polar,s="cartesian"!==t.kind;this.plotArea.setState({left:n.x,top:n.y,width:n.width,height:n.height}),this.plotArea.setBackground("transparent"===a.backgroundColor?null:a.backgroundColor),this.grid.setState({width:r.width,height:r.height}),this.grid.setState({display:!s}),this.grid.xScale=t.xAxis.scale,this.grid.yScale=t.yAxis.scale,this.grid.horizontal=t.yAxes.map(function(e,t){return{axis:e,axisLayout:i.yAxes[t],index:t}}).filter(function(e){return void 0===e.axis.option.showGrid?0===e.index:!1!==e.axis.option.showGrid}).map(function(e){return{scale:e.axis.scale,ticks:e.axisLayout.ticks,index:e.index}}),this.grid.plot=n,this.grid.grid=t.option.grid||{},this.grid.theme=a,this.grid.markDirty(),this.radarGrid.setState({width:r.width,height:r.height,display:"radar"===t.kind}),this.radarGrid.theme=a,this.radarGrid.coord="radar"===t.kind&&o&&t.radar?{polar:o,plot:n,indicators:t.radar.indicators.map(function(e,i){return{name:e.name,max:t.radarDomains[i]?t.radarDomains[i][1]:1}}),shape:t.radar.shape||"polygon",splitNumber:Math.max(1,Number(t.radar.splitNumber)||4)}:null,this.radarGrid.markDirty();var l=t.option.polarGrid,h="cartesian"===t.kind&&!!l&&"equal"===t.option.aspect;this.polarGrid.setState({width:r.width,height:r.height,display:h}),this.polarGrid.theme=a,this.polarGrid.layout=i,this.polarGrid.coord=h?{plot:n,xScale:t.xAxis.scale,yScale:t.yAxis.scale,options:!0===l?{}:l}:null,this.polarGrid.markDirty(),this.syncAxisComponents();for(var u=0;u<this.axisYList.length;u++){var c=this.axisYList[u];c.setState({width:r.width,height:r.height,display:!s}),c.layout=i,c.theme=a,c.axis=t.yAxes[u]||t.yAxis,c.axisIndex=u,c.position=t.yAxes[u]&&t.yAxes[u].position||"left",c.syncTicks(),c.markDirty()}var d=this.axisX;d.setState({width:r.width,height:r.height,display:!s}),d.layout=i,d.theme=a,d.axis=t.xAxis,d.syncTicks(),d.markDirty(),this.grid.axisX=this.axisX,this.grid.axisYList=this.axisYList,this.grid.syncTicks(),this.annotation.setState({width:r.width,height:r.height,display:!0}),this.annotation.plot=n,this.annotation.xAxis=t.xAxis,this.annotation.yAxes=t.yAxes,this.annotation.sync(t.option.annotation,{kind:t.kind,plot:n,xAxis:t.xAxis,yAxes:t.yAxes,theme:a}),this.legend&&(this.legend.setState({width:r.width,height:r.height}),this.legend.layout=i,this.legend.theme=a,this.legend.selectable=!1!==t.option.legend.selectable,this.legend.markDirty()),this.titleComponent&&(this.titleComponent.setState({width:r.width,height:r.height}),this.titleComponent.layout=i,this.titleComponent.theme=a,this.titleComponent.markDirty());for(var f=0,p=[this.crosshair,this.highlight,this.brushComponent,this.tooltip];f<p.length;f++){var v=p[f];v&&(v.setState({width:r.width,height:r.height}),v.theme=a,v.markDirty())}if(this.tooltip&&(this.tooltip.layout=i),this.crosshair){this.crosshair.layout=i,this.crosshair.option=t.option.crosshair||{};var m=Number(this.crosshair.option.followDuration);this.crosshair.followDuration=isFinite(m)&&m>=0?Math.min(400,m):90}if(this.crosshair&&this.crosshair.setState({display:!s}),this.brushComponent){var g=t.option.interaction&&t.option.interaction.brush;this.brushComponent.color=g&&!1!==g&&g.color?{fill:toAlpha(g.color,.16),stroke:g.color}:null}if(this.dataZoomSlider){var b=i.slider;if(b){this.dataZoomSlider.setState({left:b.x,top:b.y,width:b.width,height:b.height,display:!0});var k=_slicedToArray(this.domainFractions(),2),S=k[0],w=k[1];this.dataZoomSlider.setWindow(S,w)}else this.dataZoomSlider.setState({display:!1});this.dataZoomSlider.theme=a,this.dataZoomSlider.markDirty()}this.syncSeries(e)}},{key:"domainFractions",value:function domainFractions(){var e=this.fullXDomain,t=this.norm.xAxis.domain;if(!e||e.length<2||!t||t.length<2)return[0,1];if("category"===this.norm.xAxis.type){var i=e.length;if(i<=1)return[0,1];var r=Math.max(0,e.indexOf(t[0])),n=e.indexOf(t[t.length-1]);return[r/i,((n<0?i-1:n)+1)/i]}var a=Number(e[0]),o=Number(e[1])-a||1;return[(Number(t[0])-a)/o,(Number(t[1])-a)/o]}},{key:"setDomainFromFractions",value:function setDomainFromFractions(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"slider",r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("cartesian"!==this.norm.kind)return this;var n=_slicedToArray(this.domainFractions(),2),a=n[0],o=n[1];if(Math.abs(a-e)<1e-4&&Math.abs(o-t)<1e-4)return this;var s=this.fullXDomain;if("category"===this.norm.xAxis.type){var l=s.length;if(l<2)return this;var h=Math.round(e*l),u=Math.round(t*l)-1;h=Math.max(0,Math.min(l-1,h)),(u=Math.max(0,Math.min(l-1,u)))<=h&&(u=Math.min(l-1,h+1));var c=[s[h],s[u]];return this.setDomain("x",r?this.guardInteractiveXWindow(c):c,i)}var d=Number(s[0]),f=Number(s[1])-d,p=[d+f*e,d+f*t];return this.setDomain("x",r?this.guardInteractiveXWindow(p):p,i)}},{key:"syncAxisComponents",value:function syncAxisComponents(){var e=this.norm.yAxes,t=e.length,i=e.map(function(e){return e.position}).join("|");if(this.axisSignature!==i){var r,n=_createForOfIteratorHelper(this.axisYList);try{for(n.s();!(r=n.n()).done;){var a=r.value;this.root.removeChild(a)}}catch(e){n.e(e)}finally{n.f()}var o=this.layout.canvas;this.axisYList=e.map(function(e,t){return new N({orientation:"y",width:o.width,height:o.height,zIndex:Ie+t,axisIndex:t,position:e.position})}),this.root.addChildren(this.axisYList),this.axisSignature=i}for(;this.axisYList.length>t;){var s=this.axisYList.pop();this.root.removeChild(s)}}},{key:"syncSeries",value:function syncSeries(e){var t=this.norm,i=this.layout.plot,r=t.series.map(function(e){return"".concat(e.id,":").concat(e.type)}).join("|"),n=computeBarSlots(t.series);if(r!==this.seriesSignature){var a,o=_createForOfIteratorHelper(this.seriesComponents);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.root.removeChild(s)}}catch(e){o.e(e)}finally{o.f()}this.seriesComponents=t.series.map(function(e,t){return createSeriesComponent(e,{left:i.x,top:i.y,width:i.width,height:i.height,zIndex:Te+t})}),this.root.addChildren(this.seriesComponents),this.seriesSignature=r}for(var l=0;l<this.seriesComponents.length;l++){var h=this.seriesComponents[l],u=t.series[l],c=!u.hidden,d=t.yAxes[u.axisIndex]||t.yAxis,f=this.layout.polar,p="pie"===u.type?{polar:f,plot:i,canvas:this.layout.canvas}:"radar"===u.type?{polar:f,plot:i,canvas:this.layout.canvas,domains:t.radarDomains}:"funnel"===u.type?{plot:i,canvas:this.layout.canvas,options:t.funnel||{}}:"gauge"===u.type?{polar:f,plot:i,canvas:this.layout.canvas,options:t.gauge||{}}:"liquid"===u.type?{polar:f,plot:i,canvas:this.layout.canvas,options:t.liquid||{}}:"treemap"===u.type?{plot:i,canvas:this.layout.canvas,layout:layoutTreemap(u.option.data||[],i,t.treemap||{},t.theme.colorPalette),options:t.treemap||{}}:"graph"===u.type&&t.graph?{plot:i,canvas:this.layout.canvas,layout:forceLayout(t.graph.nodes||[],t.graph.links||[],i,t.graph,t.theme.colorPalette),options:t.graph}:"sankey"===u.type&&t.sankey?{plot:i,canvas:this.layout.canvas,layout:layoutSankey(t.sankey.nodes||[],t.sankey.links||[],i,t.sankey,t.theme.colorPalette),options:t.sankey}:{plot:i,canvas:this.layout.canvas,xScale:t.xAxis.scale,yScale:d.scale,yAxisIndex:u.axisIndex,theme:t.theme};if(h.setState({left:i.x,top:i.y,width:i.width,height:i.height,display:c,zIndex:Te+l,interactive:c}),h.barSlot=n[u.id]||{index:0,count:1},h.chartTheme=t.theme,h.state.ariaLabel="".concat(u.name," 系列,共 ").concat(u.points.length," 个数据点"),h.updateSeries(u,!!e&&!this.viewState.x,!!this.domainTransition),"pie"!==u.type&&"funnel"!==u.type||h.setHiddenSlices(hiddenSliceIndexes(t,u.id)),h.setCoord(p),h.markDirty(),e&&c){var v=t.option.animation;if(v&&!1!==v.enabled){var m=v["enter"===e?"enter":"update"];m&&this.playStage(h,_objectSpread2(_objectSpread2({},m),{},{kind:"enter"===e?"enter":"update"}))}}}}},{key:"playStage",value:function playStage(e,t){if(!shouldAnimate())return e.setAnimationStage(t),e.setState({progress:1}),void e.markDirty();e.setAnimationStage(t);var i=_objectSpread2({},e.props.animations||{});i.progress={from:0,to:1,duration:Math.max(1,Number(t.duration)||480),delay:Number(t.delay)||0,easing:t.easing||"easeOutCubic",startTime:void 0,finished:!1},e.props.animations=i,e.setState({progress:0}),this.ice.animationManager&&this.ice.animationManager.add(e)}},{key:"playEnter",value:function playEnter(e,t,i){this.playStage(e,{duration:t,easing:i,stagger:0})}},{key:"finishAnimations",value:function finishAnimations(){this.domainTransition=null,this.stopDomainTransition();var e,t=_createForOfIteratorHelper([].concat(_toConsumableArray(this.seriesComponents),[this.axisX],_toConsumableArray(this.axisYList),[this.grid,this.tooltip,this.crosshair]));try{for(t.s();!(e=t.n()).done;){var i=e.value;if(i){var r=i.props.animations;if(r)for(var n in r)0!==n.indexOf("__")&&r[n]&&(r[n].finished=!0);var a=!!r&&Object.keys(r).some(function(e){return 0===e.indexOf("__")});this.ice.animationManager&&!a&&this.ice.animationManager.remove(i),i.props&&i.props.animations&&i.props.animations.axisMorph&&i.setState({axisMorph:1}),Number(i.state.progress)<1&&i.setState({progress:1}),i.markDirty()}}}catch(e){t.e(e)}finally{t.f()}return this.ice.dirty=!0,this}},{key:"currentRange",value:function currentRange(){return{x:[this.norm.xAxis.domain[0],this.norm.xAxis.domain[this.norm.xAxis.domain.length-1]],y:[Number(this.norm.yAxis.domain[0]),Number(this.norm.yAxis.domain[1])]}}},{key:"clampDomain",value:function clampDomain(e,t){return"y"===e?this.clampAxisDomain(0,t):this.clampAxisDomain(-1,t)}},{key:"clampAxisDomain",value:function clampAxisDomain(e,t){var i=e<0?this.fullXDomain:this.fullYDomains[e];if(!i||i.length<2||!t||t.length<2)return null;var r=e<0?this.norm.xAxis:this.norm.yAxes[e];if(!r)return null;if("category"===r.type){var n=i,a=n.indexOf(t[0]),o=n.indexOf(t[1]);if(a<0&&(a=0),o<0&&(o=n.length-1),a>o){var s=a;a=o,o=s}return o-a<1?null:[n[a],n[o]]}var l=Number(i[0]),h=Number(i[1]),u=Math.max(l,Number(t[0])),c=Math.min(h,Number(t[1]));return!isFinite(u)||!isFinite(c)||c<=u||c-u<.001*(h-l)?null:[u,c]}},{key:"canvasRect",value:function canvasRect(){var e=this.ice&&this.ice.dpr||1,t=(this.ice&&this.ice.canvasWidth?this.ice.canvasWidth:this.canvasEl?this.canvasEl.width:0)/e,i=(this.ice&&this.ice.canvasHeight?this.ice.canvasHeight:this.canvasEl?this.canvasEl.height:0)/e;return{x:0,y:0,width:Math.max(1,Math.round(t)),height:Math.max(1,Math.round(i))}}},{key:"observeResize",value:function observeResize(){var e=this,t="undefined"!=typeof window?window.ResizeObserver:null;if(t&&this.canvasEl){var i=this.canvasEl.parentNode||this.canvasEl;this.resizeObserver=new t(function(){e.resize()}),this.resizeObserver.observe(i)}}},{key:"registerTypes",value:function registerTypes(){for(var e=0,t=[["ice-chart:PlotArea",E],["ice-chart:GridLines",D],["ice-chart:Annotation",R],["ice-chart:Axis",N],["ice-chart:Legend",L],["ice-chart:Title",z],["ice-chart:Tooltip",B],["ice-chart:Crosshair",W],["ice-chart:Highlight",V],["ice-chart:Brush",j]];e<t.length;e++){var i=_slicedToArray(t[e],2),r=i[0],n=i[1];this.ice.registerType(r,n)}}}],[{key:"restore",value:function restore(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new ICEChart(e,i.initialOption||{series:[]},i.chartOptions);return r.fromJSONObject(t,i),r}}])}();function computeBarSlots(e){var t,i=[],r={},n=_createForOfIteratorHelper(e);try{var a=function _loop(){var e=t.value;if("bar"!==e.type||e.hidden)return 1;var r=e.option.stack?"stack:".concat(e.option.stack):"single:".concat(e.id),n=i.find(function(e){return e.key===r});n||(n={key:r,members:[]},i.push(n)),n.members.push(e)};for(n.s();!(t=n.n()).done;)a()}catch(e){n.e(e)}finally{n.f()}for(var o=0;o<i.length;o++){var s,l=_createForOfIteratorHelper(i[o].members);try{for(l.s();!(s=l.n()).done;){r[s.value.id]={index:o,count:i.length}}}catch(e){l.e(e)}finally{l.f()}}return r}function hiddenSliceIndexes(e,t){var i=[],r=e.series.find(function(e){return e.id===t});if(!r)return i;var n,a=_createForOfIteratorHelper(r.points);try{for(a.s();!(n=a.n()).done;){var o=n.value;e.hiddenSlices["".concat(t,"#").concat(o.index)]&&i.push(o.index)}}catch(e){a.e(e)}finally{a.f()}return i}function isEngineThemeDark(e){try{var t=function parseHexColor(e){if("string"!=typeof e)return null;var t=e.trim();if("#"!==t.charAt(0))return null;var i=t.slice(1);3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]);return 6!==i.length?null:[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16)]}(e&&e.getTheme&&e.getTheme().semantic.background);if(!t)return!1;var i=_slicedToArray(t.map(function(e){var t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}),3);return.2126*i[0]+.7152*i[1]+.0722*i[2]<.35}catch(e){return!1}}function toAlpha(e,t){if("string"!=typeof e)return"rgba(0,0,0,".concat(t,")");if(0===e.indexOf("#")){var i=e.slice(1);if(3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),6!==i.length)return e;var r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return"rgba(".concat(r,",").concat(n,",").concat(a,",").concat(t,")")}return 0===e.indexOf("rgb(")?e.replace("rgb(","rgba(").replace(")",",".concat(t,")")):e}function applyRange(e,t,i,r){if(("x"===r||"xy"===r)&&i.x){var n,a=_createForOfIteratorHelper(e);try{var o=function _loop4(){var e=n.value;e!==t&&e.silent(function(){return e.setDomain("x",i.x,"link")})};for(a.s();!(n=a.n()).done;)o()}catch(e){a.e(e)}finally{a.f()}}if(("y"===r||"xy"===r)&&i.y){var s,l=_createForOfIteratorHelper(e);try{var h=function _loop5(){var e=s.value;e!==t&&e.silent(function(){return e.setDomain("y",i.y,"link")})};for(l.s();!(s=l.n()).done;)h()}catch(e){l.e(e)}finally{l.f()}}}exports.A11yMirror=_e,exports.Annotation=R,exports.AreaSeries=$,exports.Axis=N,exports.BOOTSTRAP_CHART_THEME=n,exports.BOOTSTRAP_DARK_CHART_THEME=a,exports.BOOTSTRAP_TOKENS=i,exports.BandScale=T,exports.BarSeries=q,exports.BoxplotSeries=le,exports.Brush=j,exports.CandlestickSeries=te,exports.ChartComponent=I,exports.Crosshair=W,exports.CurveSeriesBase=de,exports.DARK_CHART_THEME=s,exports.DEFAULT_ANIMATION_STAGES=M,exports.Emitter=we,exports.ExpressionError=m,exports.FunctionSeries=fe,exports.FunnelSeries=ne,exports.GaugeSeries=se,exports.GraphSeries=ce,exports.GridLines=D,exports.HeatmapSeries=ie,exports.Highlight=V,exports.HitResolver=be,exports.ICEChart=Le,exports.InteractionController=Se,exports.LIGHT_CHART_THEME=o,exports.Legend=L,exports.LineSeries=Y,exports.LinearScale=C,exports.LiquidSeries=ye,exports.LogScale=P,exports.ParametricSeries=pe,exports.PieSeries=Q,exports.PlotArea=E,exports.RadarGrid=U,exports.RadarSeries=ee,exports.SERIES_ROLE_HINT={line:"趋势线",area:"面积趋势",bar:"柱形",scatter:"散点",pie:"扇形",radar:"雷达多边形",candlestick:"K 线",heatmap:"热力图单元",sankey:"桑基连线",funnel:"漏斗阶段",gauge:"仪表盘",liquid:"水位球",boxplot:"箱线图",waterfall:"瀑布柱",treemap:"矩形树图单元",graph:"关系图节点",function:"函数曲线",parametric:"参数曲线"},exports.SNAPSHOT_VERSION=1,exports.SankeySeries=re,exports.ScatterSeries=Z,exports.SeriesBase=G,exports.TimeScale=v,exports.Title=z,exports.Tooltip=B,exports.TreemapSeries=ue,exports.VISUALLY_HIDDEN_STYLE=Ae,exports.WaterfallSeries=he,exports.applyChartThemeToEngine=applyChartThemeToEngine,exports.buildDataNodes=buildDataNodes,exports.buildDataTable=buildDataTable,exports.chartThemeToEnginePatch=chartThemeToEnginePatch,exports.chartTitle=chartTitle,exports.clearCustomSeriesTypes=function clearCustomSeriesTypes(){for(var e=0,t=Object.keys(xe);e<t.length;e++){var i=t[e];delete xe[i]}},exports.compileExpression=compileExpression,exports.compileSampler=compileSampler,exports.computeBarSlots=computeBarSlots,exports.computeBoxplotSummary=computeBoxplotSummary,exports.computeLayout=computeLayout,exports.createChart=function createChart(e,t,i){return"string"==typeof t||isChartSnapshot(t)?Le.restore(e,t,{chartOptions:i}):new Le(e,t,i)},exports.createScale=createScale,exports.createSeriesComponent=createSeriesComponent,exports.diagnoseExpression=diagnoseExpression,exports.errorsOf=function errorsOf(e){return e.filter(function(e){return"error"===e.severity})},exports.evaluateExpression=function evaluateExpression(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return compileExpression(e).evaluate(t)},exports.forceLayout=forceLayout,exports.formatNumberTick=formatNumberTick,exports.formatTick=formatTick,exports.getMotionPreference=function getMotionPreference(){return O},exports.getSeriesTypeFactory=getSeriesTypeFactory,exports.isBuiltinSeriesType=function isBuiltinSeriesType(e){return Object.prototype.hasOwnProperty.call(me,e)},exports.isChartSnapshot=isChartSnapshot,exports.layoutSankey=layoutSankey,exports.layoutTreemap=layoutTreemap,exports.linkCharts=function linkCharts(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.axis||"x",n=!1!==i.hover,a=!1!==i.zoom,o=!1!==i.brush,s=[],l=_createForOfIteratorHelper(e);try{var h=function _loop(){var i=t.value,l=function onHover(t){if(n&&t){var r,a=_createForOfIteratorHelper(e);try{var o=function _loop2(){var e=r.value;e!==i&&e.silent(function(){return e.showHoverAtValue(t.xValue)})};for(a.s();!(r=a.n()).done;)o()}catch(e){a.e(e)}finally{a.f()}}},h=function onLeave(){if(n){var t,r=_createForOfIteratorHelper(e);try{var a=function _loop3(){var e=t.value;e!==i&&e.silent(function(){return e.clearHover()})};for(r.s();!(t=r.n()).done;)a()}catch(e){r.e(e)}finally{r.f()}}},u=function onZoom(t){a&&t&&applyRange(e,i,t,r)},c=function onPan(t){a&&t&&applyRange(e,i,t,r)},d=function onBrush(t){o&&t&&applyRange(e,i,t,r)};i.on("item:hover",l),i.on("item:leave",h),i.on("zoom:change",u),i.on("pan:change",c),i.on("brush:end",d),s.push(function(){i.off("item:hover",l),i.off("item:leave",h),i.off("zoom:change",u),i.off("pan:change",c),i.off("brush:end",d)})};for(l.s();!(t=l.n()).done;)h()}catch(e){l.e(e)}finally{l.f()}return{charts:e,unlink:function unlink(){for(var e=0,t=s;e<t.length;e++){(0,t[e])()}s.length=0}}},exports.listSeriesTypes=function listSeriesTypes(){return[].concat(_toConsumableArray(Object.keys(me)),_toConsumableArray(Object.keys(xe)))},exports.mergeOptionPatch=mergeOptionPatch,exports.mixColors=mixColors,exports.normalizeAnimation=normalizeAnimation,exports.normalizeAnnotation=normalizeAnnotation,exports.normalizeOption=normalizeOption,exports.registerSeriesType=function registerSeriesType(e,t){if("string"!=typeof e||!ge.test(e))throw new Error("[ice-chart] registerSeriesType:类型名必须是非空字符串(字母开头,可含数字 / 下划线 / 连字符),收到「".concat(String(e),"」"));if("function"!=typeof t)throw new Error("[ice-chart] registerSeriesType:factory 必须是函数");if(Object.prototype.hasOwnProperty.call(me,e))throw new Error("[ice-chart] registerSeriesType:「".concat(e,"」是内置类型,不能覆盖(会破坏 option 的跨端可复现性)"));var i=xe[e];if(i&&i!==t)throw new Error("[ice-chart] registerSeriesType:「".concat(e,"」已经注册过另一个工厂,先 unregisterSeriesType 再注册"));xe[e]=t},exports.resolveAnnotation=resolveAnnotation,exports.resolveChartTheme=resolveChartTheme,exports.robustRange=robustRange,exports.roundRect=roundRect,exports.sampleFunctionCurve=sampleFunctionCurve,exports.sampleGraphLink=sampleGraphLink,exports.sampleLinkPath=sampleLinkPath,exports.sampleParametricCurve=sampleParametricCurve,exports.setMotionPreference=function setMotionPreference(e){O=e},exports.shouldAnimate=shouldAnimate,exports.toSerializableOption=toSerializableOption,exports.unregisterSeriesType=function unregisterSeriesType(e){return!!Object.prototype.hasOwnProperty.call(xe,e)&&(delete xe[e],!0)},exports.warningsOf=function warningsOf(e){return e.filter(function(e){return"warning"===e.severity})};
25
+ "use strict";var e=require("ice-render");function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function _callSuper(e,t,i){return t=_getPrototypeOf(t),function _possibleConstructorReturn(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,_isNativeReflectConstruct()?Reflect.construct(t,i||[],_getPrototypeOf(e).constructor):t.apply(e,i))}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_toPropertyKey(r.key),r)}}function _createClass(e,t,i){return t&&_defineProperties(e.prototype,t),i&&_defineProperties(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function _createForOfIteratorHelper(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var r=0,F=function(){};return{s:F,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,a=!0,o=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){o=!0,n=e},f:function(){try{a||null==i.return||i.return()}finally{if(o)throw n}}}}function _defineProperty(e,t,i){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var r=function _superPropBase(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}(e,t);if(r){var n=Object.getOwnPropertyDescriptor(r,t);return n.get?n.get.call(arguments.length<3?e:i):n.value}},_get.apply(null,arguments)}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_isNativeReflectConstruct=function(){return!!e})()}function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(i),!0).forEach(function(t){_defineProperty(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,n,a,o,s=[],l=!0,h=!1;try{if(a=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;l=!1}else for(;!(l=(r=a.call(i)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){h=!0,n=e}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw n}}return s}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _superPropGet(e,t,i,r){var n=_get(_getPrototypeOf(1&r?e.prototype:e),t,i);return 2&r&&"function"==typeof n?function(e){return n.apply(i,e)}:n}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){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 _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _wrapNativeSuper(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(e){if(null===e||!function _isNativeFunction(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,Wrapper)}function Wrapper(){return function _construct(e,t,i){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var n=new(e.bind.apply(e,r));return i&&_setPrototypeOf(n,i.prototype),n}(e,arguments,_getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(e.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,e)},_wrapNativeSuper(e)}var t=_toConsumableArray(e.FAMILY_PALETTE),i={primary:"#0D6EFD",secondary:"#6C757D",success:"#198754",danger:"#DC3545",warning:"#FFC107",info:"#0DCAF0",light:"#F8F9FA",dark:"#212529",indigo:"#6610F2",purple:"#6F42C1",pink:"#D63384",orange:"#FD7E14",teal:"#20C997",cyan:"#0DCAF0",gray:{100:"#F8F9FA",200:"#E9ECEF",300:"#DEE2E6",400:"#CED4DA",500:"#ADB5BD",600:"#6C757D",700:"#495057",800:"#343A40",900:"#212529"},fontFamily:'system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif',radius:6},r=i,n={backgroundColor:"transparent",colorPalette:t,textColor:r.dark,subTextColor:r.secondary,axisLineColor:r.gray[300],axisLabelColor:r.gray[600],splitLineColor:r.gray[200],labelHaloColor:"rgba(255,255,255,0.85)",fontFamily:r.fontFamily,fontSize:12,legend:{textColor:r.gray[700],inactiveColor:r.gray[400]},tooltip:{background:"#ffffff",borderColor:r.gray[300],textColor:r.dark,shadowColor:"rgba(33,37,41,0.18)",fontSize:12,padding:10,radius:r.radius},crosshair:{lineColor:r.gray[500],labelBackground:r.gray[700],labelColor:"#ffffff"},brush:{fill:"rgba(13,110,253,0.16)",stroke:"rgba(13,110,253,0.8)"},selection:{stroke:r.primary,dimOpacity:.3}},a={backgroundColor:"transparent",colorPalette:_toConsumableArray(e.FAMILY_PALETTE_DARK),textColor:r.gray[200],subTextColor:r.gray[500],axisLineColor:r.gray[700],axisLabelColor:r.gray[400],splitLineColor:r.gray[800],labelHaloColor:"rgba(10,18,32,0.88)",fontFamily:r.fontFamily,fontSize:12,legend:{textColor:r.gray[300],inactiveColor:r.gray[700]},tooltip:{background:r.gray[800],borderColor:r.gray[700],textColor:r.gray[100],shadowColor:"rgba(0,0,0,0.5)",fontSize:12,padding:10,radius:r.radius},crosshair:{lineColor:r.gray[600],labelBackground:r.gray[300],labelColor:r.dark},brush:{fill:"rgba(77,148,255,0.2)",stroke:"rgba(77,148,255,0.85)"},selection:{stroke:"#4D94FF",dimOpacity:.32}},o=n,s=a;function resolveChartTheme(e){var t="dark"===e||"auto"===e&&(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preferDark?a:n;return e&&"string"!=typeof e?_objectSpread2(_objectSpread2(_objectSpread2({},t),e),{},{legend:_objectSpread2(_objectSpread2({},t.legend),e.legend||{}),tooltip:_objectSpread2(_objectSpread2({},t.tooltip),e.tooltip||{}),crosshair:_objectSpread2(_objectSpread2({},t.crosshair),e.crosshair||{}),brush:_objectSpread2(_objectSpread2({},t.brush),e.brush||{}),selection:_objectSpread2(_objectSpread2({},t.selection),e.selection||{})}):t}function clamp$2(e,t,i){return e<t?t:e>i?i:e}function isFiniteNumber(e){return"number"==typeof e&&isFinite(e)}function extent(e){for(var t=1/0,i=-1/0,r=0;r<e.length;r++){var n=e[r];isFiniteNumber(n)&&(n<t&&(t=n),n>i&&(i=n))}if(t===1/0)return[0,1];if(t===i){var a=Math.abs(t)>1?.1*Math.abs(t):1;return[t-a,i+a]}return[t,i]}function niceStep(e,t){if(!(e>0&&t>0))return 1;var i=e/t,r=Math.pow(10,Math.floor(Math.log10(i))),n=i/r;return(n>=5?10:n>=2?5:n>=1?2:1)*r}function niceDomain(e,t){var i=_slicedToArray(e,2),r=i[0],n=i[1],a=niceStep(n-r,t);return[Math.floor(r/a)*a,Math.ceil(n/a)*a]}function round(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,i=Math.pow(10,t);return Math.round(e*i)/i}var l=1e3,h=6e4,u=36e5,c=24*u,d=30*c,f=365*c;function makeInterval(e,t,i,r,n){return{unit:e,ms:t*i,floor:function floor(e){var t=new Date(e);return r(t),t.getTime()},next:function next(e){var t=new Date(e);return n(t),t.getTime()}}}var p=[makeInterval("ms",1,1,function(){},function(e){return e.setUTCMilliseconds(e.getUTCMilliseconds()+1)}),makeInterval("ms",10,1,function(e){return e.setUTCMilliseconds(10*Math.floor(e.getUTCMilliseconds()/10))},function(e){return e.setUTCMilliseconds(e.getUTCMilliseconds()+10)}),makeInterval("ms",100,1,function(e){return e.setUTCMilliseconds(100*Math.floor(e.getUTCMilliseconds()/100))},function(e){return e.setUTCMilliseconds(e.getUTCMilliseconds()+100)}),makeInterval("s",1,l,function(e){return e.setUTCMilliseconds(0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+1)}),makeInterval("s",5,l,function(e){return e.setUTCSeconds(5*Math.floor(e.getUTCSeconds()/5),0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+5)}),makeInterval("s",15,l,function(e){return e.setUTCSeconds(15*Math.floor(e.getUTCSeconds()/15),0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+15)}),makeInterval("s",30,l,function(e){return e.setUTCSeconds(30*Math.floor(e.getUTCSeconds()/30),0)},function(e){return e.setUTCSeconds(e.getUTCSeconds()+30)}),makeInterval("m",1,h,function(e){return e.setUTCSeconds(0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+1)}),makeInterval("m",5,h,function(e){return e.setUTCMinutes(5*Math.floor(e.getUTCMinutes()/5),0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+5)}),makeInterval("m",15,h,function(e){return e.setUTCMinutes(15*Math.floor(e.getUTCMinutes()/15),0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+15)}),makeInterval("m",30,h,function(e){return e.setUTCMinutes(30*Math.floor(e.getUTCMinutes()/30),0,0)},function(e){return e.setUTCMinutes(e.getUTCMinutes()+30)}),makeInterval("h",1,u,function(e){return e.setUTCMinutes(0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+1)}),makeInterval("h",3,u,function(e){return e.setUTCHours(3*Math.floor(e.getUTCHours()/3),0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+3)}),makeInterval("h",6,u,function(e){return e.setUTCHours(6*Math.floor(e.getUTCHours()/6),0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+6)}),makeInterval("h",12,u,function(e){return e.setUTCHours(12*Math.floor(e.getUTCHours()/12),0,0,0)},function(e){return e.setUTCHours(e.getUTCHours()+12)}),makeInterval("d",1,c,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCDate(e.getUTCDate()+1)}),makeInterval("d",2,c,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCDate(e.getUTCDate()+2)}),makeInterval("d",7,c,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCDate(e.getUTCDate()+7)}),makeInterval("mo",1,d,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCMonth(e.getUTCMonth()+1)}),makeInterval("mo",3,d,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCMonth(e.getUTCMonth()+3)}),makeInterval("y",1,f,function(e){return e.setUTCHours(0,0,0,0)},function(e){return e.setUTCFullYear(e.getUTCFullYear()+1)})];function pad(e){return e<10?"0".concat(e):String(e)}var v=function(){function TimeScale(e,t){_classCallCheck(this,TimeScale),_defineProperty(this,"type","time");var i=Number(e[0]),r=Number(e[1]);this.domain=i===r?[i-c,r+c]:[Math.min(i,r),Math.max(i,r)],this.range=t}return _createClass(TimeScale,[{key:"map",value:function map(e){var t=toTimestamp(e),i=_slicedToArray(this.domain,2),r=i[0],n=i[1],a=_slicedToArray(this.range,2),o=a[0];return o+(t-r)/(n-r)*(a[1]-o)}},{key:"invert",value:function invert(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=_slicedToArray(this.range,2),a=n[0],o=n[1];return o===a?i:i+(e-a)/(o-a)*(r-i)}},{key:"pickInterval",value:function pickInterval(e){for(var t=(this.domain[1]-this.domain[0])/Math.max(1,e),i=p[0],r=1/0,n=0;n<p.length;n++){var a=Math.abs(Math.log(p[n].ms/t));a<r&&(r=a,i=p[n])}return i}},{key:"ticks",value:function ticks(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=this.pickInterval(e),i=[],r=t.floor(this.domain[0]);r<this.domain[0]&&(r=t.next(r));for(var n=0;r<=this.domain[1]&&n<1e3;n++){i.push(r);var a=t.next(r);if(a===r)break;r=a}return i}},{key:"bandwidth",value:function bandwidth(){return 0}},{key:"bandStart",value:function bandStart(e){return this.map(e)}},{key:"step",value:function step(){return this.pickInterval(5).ms}},{key:"isBand",value:function isBand(){return!1}},{key:"indexAt",value:function indexAt(e){return-1}},{key:"fractionOf",value:function fractionOf(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1];return r===i?0:(toTimestamp(e)-i)/(r-i)}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=_slicedToArray(this.domain,2),i=t[0];return i+e*(t[1]-i)}},{key:"span",value:function span(){return this.domain[1]-this.domain[0]}},{key:"format",value:function format(e,t){return function formatTime(e,t,i){var r=new Date(e),n=pad(r.getUTCHours()),a=pad(r.getUTCMinutes()),o=pad(r.getUTCSeconds()),s=pad(r.getUTCMonth()+1),l=pad(r.getUTCDate()),h=r.getUTCFullYear(),u=i>3*f;switch(t){case"ms":return"".concat(n,":").concat(a,":").concat(o,".").concat(pad(r.getUTCMilliseconds()));case"s":return"".concat(n,":").concat(a,":").concat(o);case"m":return"".concat(n,":").concat(a);case"h":return"".concat(n,":00");case"d":return u?"".concat(h,"-").concat(s,"-").concat(l):"".concat(s,"-").concat(l);case"mo":return u?"".concat(h,"-").concat(s):"".concat(s,"-01");default:return"".concat(h)}}(toTimestamp(e),this.pickInterval(5).unit,this.span())}},{key:"clone",value:function clone(){return new TimeScale([this.domain[0],this.domain[1]],[this.range[0],this.range[1]])}}])}();function toTimestamp(e){if(e instanceof Date)return e.getTime();if("string"==typeof e){var t=Date.parse(e);if(!isNaN(t))return t}var i=Number(e);return isFinite(i)?i:NaN}var m=function(){function ExpressionError(e,t,i){var r,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"syntax";return _classCallCheck(this,ExpressionError),(r=_callSuper(this,ExpressionError,["[ice-chart] 表达式错误:".concat(e,"(位置 ").concat(t,")\n ").concat(i,"\n ").concat(" ".repeat(Math.max(0,t)),"^")])).name="ExpressionError",r.position=t,r.code=n,r}return _inherits(ExpressionError,_wrapNativeSuper(Error)),_createClass(ExpressionError)}(),g={pi:Math.PI,PI:Math.PI,e:Math.E,tau:2*Math.PI,TAU:2*Math.PI,inf:1/0,Infinity:1/0,nan:NaN},b={sin:1,cos:1,tan:1,asin:1,acos:1,atan:1,atan2:2,sinh:1,cosh:1,tanh:1,asinh:1,acosh:1,atanh:1,exp:1,ln:1,log:1,log2:1,log10:1,sqrt:1,cbrt:1,abs:1,sign:1,floor:1,ceil:1,round:1,trunc:1,min:2,max:2,pow:2,mod:2,hypot:2,clamp:3},k={min:Math.min,max:Math.max,pow:Math.pow,mod:function mod(e,t){return e%t},hypot:Math.hypot,clamp:function clamp(e,t,i){return Math.max(t,Math.min(i,e))},ln:Math.log,log:Math.log,log10:Math.log10,cbrt:Math.cbrt,trunc:Math.trunc,sign:Math.sign};var S=function(){return _createClass(function Parser(e){_classCallCheck(this,Parser),_defineProperty(this,"index",0),_defineProperty(this,"variables",new Set),this.source=e,this.tokens=function tokenize(e){for(var t=[],i=0,r=function isDigit(e){return e>="0"&&e<="9"},n=function isIdentStart(e){return/[A-Za-z_]/.test(e)},a=function isIdentPart(e){return/[A-Za-z0-9_]/.test(e)};i<e.length;){var o=e[i];if(" "!==o&&"\t"!==o&&"\n"!==o&&"\r"!==o)if(r(o)||"."===o&&r(e[i+1]||"")){for(var s=i;i<e.length&&(r(e[i])||"."===e[i]);)i++;if("e"===e[i]||"E"===e[i]){var l=i;if("+"!==e[++i]&&"-"!==e[i]||i++,r(e[i]||""))for(;i<e.length&&r(e[i]);)i++;else i=l}t.push({type:"num",value:e.slice(s,i),position:s})}else if(n(o)){for(var h=i;i<e.length&&a(e[i]);)i++;t.push({type:"ident",value:e.slice(h,i),position:h})}else if("+-*/%^".indexOf(o)>=0)t.push({type:"op",value:o,position:i}),i++;else if("("!==o)if(")"!==o){if(","!==o)throw new m("无法识别的字符「".concat(o,"」"),i,e,"unknown-character");t.push({type:"comma",value:o,position:i}),i++}else t.push({type:"rparen",value:o,position:i}),i++;else t.push({type:"lparen",value:o,position:i}),i++;else i++}return t.push({type:"end",value:"",position:e.length}),t}(e)},[{key:"parse",value:function parse(){if("end"===this.peek().type)throw new m("表达式是空的",0,this.source,"empty");var e=this.parseSum(),t=this.peek();if("end"!==t.type)throw new m("多余的内容「".concat(t.value,"」"),t.position,this.source);return e}},{key:"getVariables",value:function getVariables(){return Array.from(this.variables)}},{key:"peek",value:function peek(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.tokens[Math.min(this.index+e,this.tokens.length-1)]}},{key:"next",value:function next(){return this.tokens[this.index++]}},{key:"parseSum",value:function parseSum(){for(var e=this.parseProduct();;){var t=this.peek();if("op"!==t.type||"+"!==t.value&&"-"!==t.value)return e;this.next(),e={kind:"binary",op:t.value,left:e,right:this.parseProduct()}}}},{key:"parseProduct",value:function parseProduct(){for(var e=this.parseUnary();;){var t=this.peek();if("op"===t.type&&"*/%".indexOf(t.value)>=0)this.next(),e={kind:"binary",op:t.value,left:e,right:this.parseUnary()};else{if(!this.startsAtom(t)||!this.endsAtom(e))return e;e={kind:"binary",op:"*",left:e,right:this.parseUnary()}}}}},{key:"startsAtom",value:function startsAtom(e){return"num"===e.type||"ident"===e.type||"lparen"===e.type}},{key:"endsAtom",value:function endsAtom(e){return"num"===e.kind||"var"===e.kind&&void 0!==g[e.name]}},{key:"parseUnary",value:function parseUnary(){var e=this.peek();return"op"!==e.type||"-"!==e.value&&"+"!==e.value?this.parsePower():(this.next(),{kind:"unary",op:e.value,arg:this.parseUnary()})}},{key:"parsePower",value:function parsePower(){var e=this.parseAtom(),t=this.peek();return"op"===t.type&&"^"===t.value?(this.next(),{kind:"binary",op:"^",left:e,right:this.parseUnary()}):e}},{key:"parseAtom",value:function parseAtom(){var e=this.next();if("num"===e.type){var t=Number(e.value);if(!isFinite(t))throw new m("无法解析的数字「".concat(e.value,"」"),e.position,this.source);return{kind:"num",value:t}}if("lparen"===e.type){var i=this.parseSum(),r=this.peek();if("rparen"!==r.type)throw new m("缺少右括号",r.position,this.source);return this.next(),i}if("ident"===e.type){var n=e.value;if("lparen"===this.peek().type){var a=b[n];if(void 0===a)throw new m("未知函数「".concat(n,"」"),e.position,this.source,"unknown-function");this.next();for(var o=[this.parseSum()];"comma"===this.peek().type;)this.next(),o.push(this.parseSum());var s=this.peek();if("rparen"!==s.type)throw new m("函数「".concat(n,"」缺少右括号"),s.position,this.source);if(this.next(),o.length!==a)throw new m("函数「".concat(n,"」需要 ").concat(a," 个参数,收到 ").concat(o.length," 个"),e.position,this.source,"arity");return{kind:"call",name:n,args:o}}return void 0!==g[n]?{kind:"num",value:g[n]}:(this.variables.add(n),{kind:"var",name:n})}throw new m("end"===e.type?"表达式意外结束":"这里不该出现「".concat(e.value,"」"),e.position,this.source)}}])}();function compileNode(e){switch(e.kind){case"num":return function(){return e.value};case"var":return function(t){var i=t[e.name];return"number"==typeof i?i:NaN};case"unary":var t=compileNode(e.arg);return"-"===e.op?function(e){return-t(e)}:t;case"binary":var i=compileNode(e.left),r=compileNode(e.right);switch(e.op){case"+":return function(e){return i(e)+r(e)};case"-":return function(e){return i(e)-r(e)};case"*":return function(e){return i(e)*r(e)};case"/":return function(e){return i(e)/r(e)};case"%":return function(e){return i(e)%r(e)};case"^":return function(e){return Math.pow(i(e),r(e))};default:return function(){return NaN}}case"call":var n=e.name,a=k[n]||Math[n],o=e.args.map(compileNode);return a?function(e){return a.apply(void 0,_toConsumableArray(o.map(function(t){return t(e)})))}:function(){return NaN}}}var w=new Map;function compileExpression(e){var t=String(null==e?"":e),i=w.get(t);if(i)return i;var r=new S(t),n=compileNode(r.parse()),a={source:t,variables:r.getVariables(),evaluate:function evaluate(e){return n(e||{})}};return w.set(t,a),a}function compileSampler(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=compileExpression(e),r=_objectSpread2({},t);return{setParams:function setParams(e){for(var t=0,i=Object.keys(e);t<i.length;t++){var n=i[t];r[n]=Number(e[n])}},evaluate:function evaluate(e,t){return r[e]=t,i.evaluate(r)}}}function quantile(e,t){return e.length?e[Math.min(e.length-1,Math.max(0,Math.round((e.length-1)*t)))]:NaN}function diagnoseExpression(e,t){var i=String(null==e?"":e),r=t.params||{},n=[];if(!i.trim())return n.push({code:"empty",severity:"error",message:"表达式是空的:请填写 ".concat(t.variable," 的公式,例如 ").concat("t"===t.variable?"sin(3*t)":"sin(x)/x")}),n;var a=[];try{a=compileExpression(i).variables}catch(e){return e instanceof m?(n.push({code:e.code,severity:"error",message:e.message,position:e.position}),n):(n.push({code:"syntax",severity:"error",message:String(e&&e.message?e.message:e)}),n)}var o,s=[t.variable].concat(_toConsumableArray(Object.keys(r))),l=a.filter(function(e){return e!==t.variable&&!(e in r)}),h=_createForOfIteratorHelper(l);try{for(h.s();!(o=h.n()).done;){var u=o.value;n.push({code:"unknown-variable",severity:"error",message:"未定义的变量「".concat(u,"」:可用的是 ").concat(s.join("、"),"。想当参数用请写进 series.params(会自动进 JSON 快照)。")})}}catch(e){h.e(e)}finally{h.f()}var c,d=new Set([].concat(_toConsumableArray(a),_toConsumableArray(t.additionalVariables||[]))),f=Object.keys(r).filter(function(e){return!d.has(e)}),p=_createForOfIteratorHelper(f);try{for(p.s();!(c=p.n()).done;){var v=c.value;n.push({code:"unused-parameter",severity:"warning",message:"参数「".concat(v,"」定义了但表达式没有用到,改公式或去掉它。")})}}catch(e){p.e(e)}finally{p.f()}var g=t.values;if(g&&g.length&&!n.some(function(e){return"error"===e.severity})){var b=g.filter(function(e){return"number"==typeof e&&isFinite(e)});if(b.length){var k=b.slice().sort(function(e,t){return e-t}),S=quantile(k,.02),w=quantile(k,.98);Math.abs(w-S)<1e-12&&n.push({code:"constant-value",severity:"warning",message:"输出恒为 ".concat(Number(w.toPrecision(6)),":函数与自变量无关(或恰好取到常数),画出来是一条水平线。")})}else n.push({code:"no-finite-values",severity:"error",message:"在当前区间内没有任何可绘制的值:检查是否对负数开方、对 0 取对数,或者分母整段为 0。"})}return n}var A=1e7;function robustRange(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=e.filter(function(e){return"number"==typeof e&&isFinite(e)&&Math.abs(e)<A});if(!i.length)return[-1,1];var r=i.slice().sort(function(e,t){return e-t}),n=function at(e){return r[Math.min(r.length-1,Math.max(0,Math.round((r.length-1)*e)))]},a=n(.5),o=n(.75)-n(.25),s=r[0],l=r[r.length-1];if(o>0&&(s=Math.max(s,a-t*o),l=Math.min(l,a+t*o)),!(l>s)){var h=(l+s)/2,u=Math.max(1,.2*Math.abs(h));s=h-u,l=h+u}return[s,l]}function refineSegment(e,t,i,r,n,a,o){var s=(t+r)/2;if(isFinite(s)&&s!==t&&s!==r){var l=e.evaluate(s);if(e.isBreak(l))o.push(s,NaN);else e.adaptive&&a<e.maxDepth&&e.count<e.maxSamples&&!e.isBreak(i)&&!e.isBreak(n)&&e.deviation(i,l,n)>e.tolerance&&(e.count++,refineSegment(e,t,i,s,l,a+1,o),e.emit(s,l,o),refineSegment(e,s,l,r,n,a+1,o))}}function sampleFunctionCurve(e,t,i){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=Math.max(2,Math.round(r.base||240)),a=new Float64Array(n),o=new Float64Array(n),s=0;s<n;s++){var l=t+(i-t)*s/(n-1),h=e(l);a[s]=l,o[s]=isFinite(h)&&Math.abs(h)<A?h:NaN}for(var u=_slicedToArray(robustRange(Array.from(o)),2),c=u[0],d=u[1],f=Math.max(1e-9,d-c),p={tolerance:Math.max(1e-9,(void 0===r.tolerance?.0025:r.tolerance)*f),maxDepth:void 0===r.maxDepth?7:r.maxDepth,maxSamples:void 0===r.maxSamples?6e3:r.maxSamples,count:n,adaptive:!1!==r.adaptive,evaluate:function evaluate(t){return e(t)},isBreak:function isBreak(e){return!isFinite(e)||Math.abs(e)>A},deviation:function deviation(e,t,i){return Math.abs(t-(e+i)/2)},emit:function emit(e,t,i){i.push(e,t)}},v=[],m=0;m<n&&(v.push(a[m],isFinite(o[m])?o[m]:NaN),m!==n-1);m++)refineSegment(p,a[m],o[m],a[m+1],o[m+1],0,v);for(var g=[],b=0;b<v.length;b+=2)g.push([v[b],v[b+1]]);return function breakPoles(e,t){for(var i=20*Math.max(1e-9,t),r=[],n=0;n<e.length;n++){var a=e[n],o=r.length?r[r.length-1]:null;o&&isFinite(o[1])&&isFinite(a[1])&&o[1]*a[1]<0&&Math.abs(a[1]-o[1])>i&&r.push([(o[0]+a[0])/2,NaN]),r.push(a)}return r}(g,f)}function sampleParametricCurve(e,t,i,r){for(var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=Math.max(2,Math.round(n.base||360)),o=new Float64Array(a),s=new Float64Array(a),l=new Float64Array(a),h=0;h<a;h++){var u=i+(r-i)*h/(a-1);o[h]=u,s[h]=e(u),l[h]=t(u)}for(var c=_slicedToArray(robustRange(Array.from(s)),2),d=c[0],f=c[1],p=_slicedToArray(robustRange(Array.from(l)),2),v=p[0],m=p[1],g=Math.max(1e-9,Math.hypot(f-d,m-v)),b={tolerance:Math.max(1e-9,(void 0===n.tolerance?.0015:n.tolerance)*g),maxDepth:void 0===n.maxDepth?7:n.maxDepth,maxSamples:void 0===n.maxSamples?8e3:n.maxSamples,count:a,adaptive:!1!==n.adaptive,evaluate:function evaluate(i){return[e(i),t(i)]},isBreak:function isBreak(e){return!isFinite(e[0])||!isFinite(e[1])||Math.abs(e[0])>A||Math.abs(e[1])>A},deviation:function deviation(e,t,i){return function midDeviation(e,t,i,r,n,a){var o=i-e,s=r-t,l=o*o+s*s;if(0===l)return Math.hypot(n-e,a-t);var h=((n-e)*o+(a-t)*s)/l;return h=Math.max(0,Math.min(1,h)),Math.hypot(n-(e+h*o),a-(t+h*s))}(e[0],e[1],i[0],i[1],t[0],t[1])},emit:function emit(e,t,i){i.push(t[0],t[1])}},k=[],S=0;S<a;S++){var w=s[S],_=l[S],M=!isFinite(w)||!isFinite(_)||Math.abs(w)>A||Math.abs(_)>A;if(k.push(M?NaN:w,M?NaN:_),S===a-1)break;refineSegment(b,o[S],[s[S],l[S]],o[S+1],[s[S+1],l[S+1]],0,k)}for(var C=[],T=0;T<k.length;T+=2)C.push([k[T],k[T+1]]);return C}var _={top:12,right:16,bottom:12,left:12};function padDomain(e,t,i,r,n){var a=i&&void 0!==i.padding?Number(i.padding):.05;if(!isFinite(a)||a<=0)return[e,t];var o=t-e;if(!isFinite(o)||o<=0)return[e,t];var s=o*Math.min(.5,a);return[r?e:e-s,n?t:t+s]}var M={enter:{duration:520,delay:0,easing:"easeOutCubic",stagger:.35},update:{duration:420,delay:0,easing:"easeOutCubic",stagger:0},highlight:{duration:260,delay:0,easing:"springSnappy",stagger:0}};function normalizeAnimation(e){if(!1===e)return{enabled:!1,enter:!1,update:!1,highlight:!1};var t=e||{},i=!1!==t.enabled,r={duration:t.duration,easing:t.easing,stagger:t.stagger,delay:t.delay},n=function stage(e){if(!1===t[e])return!1;var i=_objectSpread2({},M[e]);if("enter"===e)for(var n=0,a=Object.keys(r);n<a.length;n++){var o=a[n];void 0!==r[o]&&(i[o]=r[o])}return t[e]&&"object"===_typeof(t[e])&&Object.assign(i,t[e]),i};return{enabled:i,enter:n("enter"),update:n("update"),highlight:n("highlight")}}function normalizeAnnotation(e){if(!e||"object"!==_typeof(e))return null;var t=function list(e){return Array.isArray(e)?e.filter(function(e){return e&&"object"===_typeof(e)}):[]},i=t(e.lines),r=t(e.points),n=t(e.areas);return i.length||r.length||n.length?{lines:i,points:r,areas:n}:null}function normalizeOption(e){var t,i,r,n,a,o,s,l,h,u,c,d,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||!Array.isArray(e.series))throw new Error("[ice-chart] option.series 必须是数组。");var p=resolveChartTheme(e.theme,{preferDark:!!f.preferDark}),v={legend:_objectSpread2({show:e.series.length>1,position:"top",itemWidth:12,itemHeight:12,itemGap:16,selectable:!0},e.legend||{}),tooltip:_objectSpread2({show:!0,trigger:"axis"},e.tooltip||{}),crosshair:_objectSpread2({show:!0,type:"line",axis:"x",showAxisLabel:!0},e.crosshair||{}),grid:_objectSpread2({show:!0,x:!1,y:!0,lineWidth:1},e.grid||{}),interaction:{hover:_objectSpread2({enabled:!0,mode:"nearest-x",dimOthers:!1},(null===(t=e.interaction)||void 0===t?void 0:t.hover)||{}),select:_objectSpread2({enabled:!1,mode:"single",toggle:!0},(null===(i=e.interaction)||void 0===i?void 0:i.select)||{}),brush:!1!==(null===(r=e.interaction)||void 0===r?void 0:r.brush)&&_objectSpread2({enabled:!1,axes:"x",mode:"select"},(null===(n=e.interaction)||void 0===n?void 0:n.brush)||{}),zoom:!1!==(null===(a=e.interaction)||void 0===a?void 0:a.zoom)&&_objectSpread2({enabled:!0,axes:"x",wheel:!0,wheelFactor:1.2,mode:"data"},(null===(o=e.interaction)||void 0===o?void 0:o.zoom)||{}),pan:!1!==(null===(s=e.interaction)||void 0===s?void 0:s.pan)&&_objectSpread2({enabled:!1,axes:"xy"},(null===(l=e.interaction)||void 0===l?void 0:l.pan)||{}),keyboard:void 0===(null===(h=e.interaction)||void 0===h?void 0:h.keyboard)||e.interaction.keyboard},animation:normalizeAnimation(e.animation),margin:_objectSpread2(_objectSpread2({},_),e.margin||{})};v.series=e.series,v.title=e.title,v.xAxis=e.xAxis||{},v.yAxis=e.yAxis||{},v.dataZoom=e.dataZoom||null,v.theme=e.theme,v.aspect="equal"===e.aspect?"equal":"auto",v.polarGrid=e.polarGrid||null,v.annotation=normalizeAnnotation(e.annotation),v.tooltip=_objectSpread2({show:!1!==(null===(u=e.tooltip)||void 0===u?void 0:u.show)},v.tooltip),v.crosshair=_objectSpread2({show:!1!==(null===(c=e.crosshair)||void 0===c?void 0:c.show)},v.crosshair);for(var m=e.radar||null,g=e.graph||null,b=function buildSeries(e,t,i,r,n,a,o){for(var s=[],l={},h=0;h<e.length;h++){var u=e[h];if(!u||!u.type)throw new Error("[ice-chart] series[".concat(h,"] 缺少 type。"));var c=u.name;c||(c="series-".concat(h+1)),void 0!==l[c]?(l[c]+=1,c="".concat(c," (").concat(l[c],")")):l[c]=0;var d=u.id||"series-".concat(h),f=u.color||t.colorPalette[h%t.colorPalette.length],p=buildPoints(u,r,n,a,o),v=p.points,m=p.hasExplicitX;if("pie"===u.type)for(var g=0;g<v.length;g++){var b=v[g].raw,k=b&&"object"===_typeof(b)&&!Array.isArray(b)?b.color:void 0;v[g].color=k||(0===g&&u.color?u.color:t.colorPalette[g%t.colorPalette.length])}var S={id:d,index:h,type:u.type,name:c,color:f,option:u,points:v,hasExplicitX:m,hidden:!1,axisIndex:0};applyCurveDomain(S,u),s.push(S)}return s}(e.series,p,null===(d=v.legend)||void 0===d||d.selected,m,e.sankey||null,g,f),k=0,S=b;k<S.length;k++){var w=S[k];if("waterfall"===w.type){var A=w.option.waterfall,M=void 0!==A?A:e.waterfall;void 0!==M&&(w.waterfallOption=M)}}for(var C=_objectSpread2({},f.hiddenIds||{}),T=0,P=b;T<P.length;T++){var I,O=P[T];null!==(I=v.legend)&&void 0!==I&&I.selected&&!1===v.legend.selected[O.name]&&(C[O.id]=!0),O.hidden=!!C[O.id]||!1===O.option.show}var N=b.some(function(e){return"pie"===e.type})?"polar":b.some(function(e){return"radar"===e.type})?"radar":b.some(function(e){return"sankey"===e.type})?"sankey":b.some(function(e){return"funnel"===e.type})?"funnel":b.some(function(e){return"gauge"===e.type})?"gauge":b.some(function(e){return"liquid"===e.type})?"liquid":b.some(function(e){return"treemap"===e.type})?"treemap":b.some(function(e){return"graph"===e.type})?"graph":"cartesian",D="sankey"===N&&e.sankey||null,H="funnel"===N?e.funnel||{}:null,R="gauge"===N?e.gauge||{}:null,E="liquid"===N?e.liquid||{}:null,L="treemap"===N?e.treemap||{}:null,z="graph"===N?g:null,B=_objectSpread2({},f.hiddenSlices||{}),W=m?function buildRadarDomains(e,t){for(var i=[],r=Array.isArray(e.indicators)?e.indicators.length:0,n=0;n<r;n++){var a,o=e.indicators[n]||{name:String(n)},s=-1/0,l=_createForOfIteratorHelper(t);try{for(l.s();!(a=l.n()).done;){var h=a.value;if("radar"===h.type&&!h.hidden){var u=h.points[n];u&&null!==u.y&&u.y>s&&(s=u.y)}}}catch(e){l.e(e)}finally{l.f()}isFinite(s)||(s=1);var c=isFiniteNumber(o.min)?o.min:0,d=isFiniteNumber(o.max)?o.max:s;i.push([c,d>c?d:c+1])}return i}(m,b):[];"cartesian"===N||e.tooltip&&void 0!==e.tooltip.trigger||(v.tooltip.trigger="item");var V=v.xAxis;"value"===V.type&&(V.type="linear");var j=Array.isArray(e.yAxis)?e.yAxis:[e.yAxis||{}];j.length||j.push({});var U,X=_createForOfIteratorHelper(j);try{for(X.s();!(U=X.n()).done;){var K=U.value;"value"===K.type&&(K.type="linear")}}catch(e){X.e(e)}finally{X.f()}for(var G=0,Y=b;G<Y.length;G++){var q=Y[G],$=Number(q.option.yAxisIndex);q.axisIndex=isFinite($)?Math.max(0,Math.min(j.length-1,Math.floor($))):0}var Z=function isHorizontalLayout(e,t){var i="category"===t.type||Array.isArray(t.data)&&t.data.length>0;return!!i&&!("category"===e.type||Array.isArray(e.data)&&e.data.length>0)}(V,j[0]);!Z||e.tooltip&&void 0!==e.tooltip.trigger||(v.tooltip.trigger="item"),function applyAxisCategories(e,t){if(!e||!Array.isArray(e.data)||!e.data.length)return;var i,r=e.data,n=_createForOfIteratorHelper(t);try{for(n.s();!(i=n.n()).done;){var a,o=_createForOfIteratorHelper(i.value.points);try{for(o.s();!(a=o.n()).done;){var s=a.value;s.xValue===s.index&&(void 0!==r[s.index]&&(s.xValue=r[s.index],void 0===s.name&&(s.name=String(r[s.index]))))}}catch(e){o.e(e)}finally{o.f()}}}catch(e){n.e(e)}finally{n.f()}}(Z?j[0]:V,b);var J,Q,ee=Z?V.type&&"category"!==V.type?V.type:"linear":function resolveXAxisType(e,t){if(e.type)return e.type;if(t.some(function(e){return"bar"===e.type||"candlestick"===e.type||"heatmap"===e.type||"boxplot"===e.type||"waterfall"===e.type}))return"category";var i,r=[],n=_createForOfIteratorHelper(t);try{for(n.s();!(i=n.n()).done;){var a,o=_createForOfIteratorHelper(i.value.points);try{for(o.s();!(a=o.n()).done;){var s=a.value;if(r.push(s.xValue),r.length>2e3)break}}catch(e){o.e(e)}finally{o.f()}}}catch(e){n.e(e)}finally{n.f()}if(r.some(function(e){return e instanceof Date}))return"time";if(r.some(function(e){return"number"==typeof e&&Math.abs(e)>1e11}))return"time";if(r.some(function(e){return"string"==typeof e&&!isFinite(Number(e))}))return"category";return"linear"}(V,b);if(Z){J=buildYDomain(b,0,V,ee),Q=[];var te=function buildCategoryValues(e,t){if(Array.isArray(e.data)&&e.data.length)return e.data.slice();var i,r={},n=[],a=_createForOfIteratorHelper(t);try{for(a.s();!(i=a.n()).done;){var o,s=_createForOfIteratorHelper(i.value.points);try{for(s.s();!(o=s.n()).done;){var l=o.value,h=void 0===l.name?l.xValue:l.name,u=String(h);r[u]||(r[u]=!0,n.push(h))}}catch(e){s.e(e)}finally{s.f()}}}catch(e){a.e(e)}finally{a.f()}return n}(j[0],b);j[0]=_objectSpread2(_objectSpread2({},j[0]),{},{type:"category"}),j[0].__categories=te}else{var ie=function buildXDomain(e,t,i){if("category"===e){if(Array.isArray(i.data)&&i.data.length)return{domain:i.data.slice(),categories:i.data.slice()};var r,n={},a=[],o=_createForOfIteratorHelper(t);try{for(o.s();!(r=o.n()).done;){var s,l=_createForOfIteratorHelper(r.value.points);try{for(l.s();!(s=l.n()).done;){var h=s.value,u=String(h.xValue);n[u]||(n[u]=!0,a.push(h.xValue))}}catch(e){l.e(e)}finally{l.f()}}}catch(e){o.e(e)}finally{o.f()}return{domain:a,categories:a}}var c,d=[],f=_createForOfIteratorHelper(t);try{for(f.s();!(c=f.n()).done;){var p=c.value;if(p.domainXValues&&p.domainXValues.length){var v,m=_createForOfIteratorHelper(p.domainXValues);try{for(m.s();!(v=m.n()).done;){var g=v.value;isFinite(g)&&d.push(g)}}catch(e){m.e(e)}finally{m.f()}}else{var b,k=_createForOfIteratorHelper(p.points);try{for(k.s();!(b=k.n()).done;){var S=b.value,w="time"===e?toTimestamp(S.xValue):Number(S.xValue);isFinite(w)&&d.push(w)}}catch(e){k.e(e)}finally{k.f()}}}}catch(e){f.e(e)}finally{f.f()}var A=_slicedToArray(extent(d),2),_=A[0],M=A[1],C=isFiniteNumber(i.min),T=isFiniteNumber(i.max);C&&(_=i.min);T&&(M=i.max);if(!1!==i.nice){var P=_slicedToArray(niceDomain([_,M],i.tickCount||5),2);_=P[0],M=P[1]}if("log"!==e){var I=_slicedToArray(padDomain(_,M,i,C,T),2);_=I[0],M=I[1]}return{domain:[_,M],categories:[]}}(ee,b,V);J=ie.domain,Q=ie.categories}var re=function resolveXDomain(e,t,i){if(!i)return t;if("category"!==e)return[i[0],i[1]];var r=t.indexOf(i[0]),n=t.indexOf(i[1]);return r>=0&&n>=r?t.slice(r,n+1):t}(ee,J,f.xDomain);!function applyStacking(e){var t,i={},r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(n.option.stack){var a="".concat(n.axisIndex,"::").concat(n.option.stack);(i[a]=i[a]||[]).push(n)}else{var o,s=_createForOfIteratorHelper(n.points);try{for(s.s();!(o=s.n()).done;){var l=o.value;l.base=0,l.top=null===l.y?0:l.y}}catch(e){s.e(e)}finally{s.f()}}}}catch(e){r.e(e)}finally{r.f()}for(var h in i){var u,c={},d=_createForOfIteratorHelper(i[h]);try{for(d.s();!(u=d.n()).done;){var f,p=_createForOfIteratorHelper(u.value.points);try{for(p.s();!(f=p.n()).done;){var v=f.value,m=String(v.xValue),g=c[m]||0,b=null===v.y?0:v.y;v.base=g,v.top=g+b,c[m]=v.top}}catch(e){p.e(e)}finally{p.f()}}}catch(e){d.e(e)}finally{d.f()}}}(b),function applyWaterfall(e){var t,i=_createForOfIteratorHelper(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;if("waterfall"===r.type){var n,a=0,o=_createForOfIteratorHelper(r.points);try{for(o.s();!(n=o.n()).done;){var s=n.value,l=s.raw,h=!(!l||"object"!==_typeof(l)||Array.isArray(l)||!l.total),u=s.y||0;h?(s.base=0,s.top=a):(s.base=a,s.top=a+u,a+=u)}}catch(e){o.e(e)}finally{o.f()}}}}catch(e){i.e(e)}finally{i.f()}}(b);var ne={option:V,type:ee,domain:re,scale:null,index:0,position:"left"},ae=b.some(function(e){return"heatmap"===e.type}),oe=j.map(function(e,t){if(Z&&0===t)return{option:e,type:"category",domain:e.__categories||[],scale:null,index:t,position:e.position||"left"};if(ae&&(void 0===e.type||"category"===e.type)){for(var i={},r=[],n=0,a=b;n<a.length;n++){var o=a[n];if("heatmap"===o.type){var s,l=_createForOfIteratorHelper(o.points);try{for(l.s();!(s=l.n()).done;){var h=s.value,u=String(void 0===h.name?h.xValue:h.name);i[u]||(i[u]=!0,r.push(void 0===h.name?h.xValue:h.name))}}catch(e){l.e(e)}finally{l.f()}}}return{option:e,type:"category",domain:r,scale:null,index:t,position:e.position||(0===t?"left":"right")}}var c=e.type||"linear",d=f.yDomains?f.yDomains[t]:0===t?f.yDomain:null;return{option:e,type:c,domain:d||buildYDomain(b,t,e,c),scale:null,index:t,position:e.position||(0===t?"left":"right")}}),se=oe[0];return function applyEqualAspect(e,t,i,r){if("equal"!==e.aspect||"cartesian"!==t)return;if("category"===i.type)return;var n=r[0];if(!n||"category"===n.type)return;var a=Number(i.domain[0]),o=Number(i.domain[1]),s=Number(n.domain[0]),l=Number(n.domain[1]);if(![a,o,s,l].every(function(e){return isFinite(e)}))return;var h=Math.abs(o-a),u=Math.abs(l-s),c=Math.max(h,u);if(!(c>0))return;if(h<c){var d=(a+o)/2;i.domain=[d-c/2,d+c/2]}if(u<c){var f=(s+l)/2;n.domain=[f-c/2,f+c/2]}}(e,N,ne,oe),{labels:_objectSpread2({chart:"图表",sector:"扇区",value:"数值",ratio:"占比",indicator:"指标",coordinate:"坐标",liquid:"水位",slice:"切片"},e.labels||{}),kind:N,orientation:Z?"horizontal":"vertical",radar:m,sankey:D,funnel:H,gauge:R,liquid:E,treemap:L,graph:z,radarDomains:W,option:v,theme:p,series:b,xAxis:ne,yAxes:oe,yAxis:se,categories:Q,visibleSeries:b.filter(function(e){return!e.hidden}),hiddenIds:C,hiddenSlices:B}}function buildPoints(e,t,i,r,n){var a=Array.isArray(e.data)?e.data:[],o=[],s=!1;if("function"===e.type||"parametric"===e.type)return function buildCurvePoints(e,t){var i=[],r=e.params||{},n="function"===e.type,a=void 0===e.polarExpression||null===e.polarExpression?"":String(e.polarExpression).trim(),o=!n&&""!==a,s=n?String(e.expression||""):o?a:String(e.xExpression||""),l=n||o?"":String(e.yExpression||""),h=null,u=null;try{h=compileExpression(s),n||o||(u=compileExpression(l))}catch(e){h=null,u=null}var c=n?[-10,10]:[0,2*Math.PI],d=Array.isArray(e.domain)&&e.domain.length>=2?e.domain:null,f=d?Number(d[0]):c[0],p=d?Number(d[1]):c[1];if(n&&t&&Array.isArray(t.xDomain)&&t.xDomain.length>=2){var v=Number(t.xDomain[0]),m=Number(t.xDomain[1]);isFinite(v)&&isFinite(m)&&m>v&&(f=v,p=m)}isFinite(f)&&isFinite(p)&&p!==f||(f=c[0],p=c[1]);for(var g=Number(e.samples),b=Math.max(24,Math.min(6e3,isFinite(g)&&g>0?Math.round(g):n?240:360)),k=_objectSpread2({},r),S=n?"x":"t",w=0;w<b;w++){var A=f+(p-f)*w/(b-1);k[S]=A;var _=A,M=NaN,C=NaN;h&&(n?M=h.evaluate(k):o?(_=(C=h.evaluate(k))*Math.cos(A),M=C*Math.sin(A)):u&&(_=h.evaluate(k),M=u.evaluate(k)));var T=isFinite(_)&&isFinite(M);i.push({index:w,xValue:A,y:T?M:null,raw:n?{x:A,y:M}:o?{t:A,x:_,y:M,r:C}:{t:A,x:_,y:M},base:0,top:T?M:0,name:n?s:o?"r = ".concat(s):"(".concat(s,", ").concat(l,")")})}return{points:i,hasExplicitX:!0}}(e,n);if("graph"===e.type&&r){for(var l=Array.isArray(r.nodes)?r.nodes:[],h=Array.isArray(r.links)?r.links:[],u=function indexOf(e){return"number"==typeof e?e:l.findIndex(function(t){return t.id===e||t.name===e})},c=0;c<l.length;c++){var d=l[c],f=toNumber(d.value);o.push({index:c,xValue:d.name,y:f,raw:d,base:0,top:null===f?0:f,name:d.name})}for(var p=0;p<h.length;p++){var v=h[p],m=u(v.source),g=u(v.target),b="".concat(m>=0?l[m].name:String(v.source)," → ").concat(g>=0?l[g].name:String(v.target)),k=toNumber(v.value);o.push({index:l.length+p,xValue:b,y:null===k?1:k,raw:{__graphLink:!0,source:v.source,target:v.target,value:v.value},base:0,top:null===k?1:k,name:b})}return{points:o,hasExplicitX:!0}}if("sankey"===e.type&&i){var S,w=Array.isArray(i.nodes)?i.nodes:[],A=Array.isArray(i.links)?i.links:[],_=new Array(w.length).fill(0),M=new Array(w.length).fill(0),C=function _indexOf(e){return"number"==typeof e?e:w.findIndex(function(t){return t.name===e})},T=_createForOfIteratorHelper(A);try{for(T.s();!(S=T.n()).done;){var P=S.value,I=C(P.source),O=C(P.target),N=Number(P.value)||0;I>=0&&(M[I]+=N),O>=0&&(_[O]+=N)}}catch(e){T.e(e)}finally{T.f()}for(var D=_.map(function(e,t){return Math.max(e,M[t])}),H=0;H<w.length;H++){var R=w[H];o.push({index:H,xValue:R.name,y:D[H],raw:R,base:0,top:D[H],name:R.name})}for(var E=0;E<A.length;E++){var L=A[E],z=C(L.source),B=C(L.target),W="".concat(z>=0?w[z].name:String(L.source)," → ").concat(B>=0?w[B].name:String(L.target));o.push({index:w.length+E,xValue:W,y:Number(L.value)||0,raw:{__sankeyLink:!0,source:L.source,target:L.target,value:L.value},base:0,top:Number(L.value)||0,name:W})}return{points:o,hasExplicitX:!0}}if("radar"===e.type&&t&&Array.isArray(t.indicators)){for(var V=0;V<t.indicators.length;V++){var j=t.indicators[V],U=a[V],X=U&&"object"===_typeof(U)&&!Array.isArray(U)&&void 0!==U.value?toNumber(U.value):toNumber(U);o.push({index:V,xValue:j.name,y:X,raw:U,base:0,top:null===X?0:X,name:j.name})}return{points:o,hasExplicitX:!0}}if("candlestick"===e.type){for(var K=0;K<a.length;K++){var G=a[K],Y=Array.isArray(G)?G:G&&"object"===_typeof(G)&&Array.isArray(G.value)?G.value:null;if(!Y||Y.length<4)o.push({index:K,xValue:K,y:null,raw:G,base:0,top:0});else{var q=toNumber(Y[0]),$=toNumber(Y[1]),Z=toNumber(Y[2]),J=toNumber(Y[3]),Q=G&&"object"===_typeof(G)&&!Array.isArray(G)&&void 0!==G.name?String(G.name):void 0;s=!0,o.push({index:K,xValue:void 0===Q?K:Q,y:$,raw:G,base:0,top:null===$?0:$,name:Q,ohlc:[null===q?0:q,null===$?0:$,null===Z?0:Z,null===J?0:J]})}}return{points:o,hasExplicitX:s}}if("heatmap"===e.type){for(var ee=0;ee<a.length;ee++){var te=a[ee];if(!Array.isArray(te)||te.length<3)o.push({index:ee,xValue:ee,y:null,raw:te,base:0,top:0});else{var ie=toNumber(te[2]);s=!0,o.push({index:ee,xValue:te[0],y:ie,raw:te,base:0,top:null===ie?0:ie,name:String(te[1])})}}return{points:o,hasExplicitX:s}}if("boxplot"===e.type){for(var re=0;re<a.length;re++){var ne=a[re],ae=Array.isArray(ne)?ne.map(function(e){return Number(e)}):null;if(ae&&ae.length){var oe=5===ae.length?[ae[0],ae[1],ae[2],ae[3],ae[4]]:computeBoxplotSummary(ae);s=!0,o.push({index:re,xValue:re,y:oe[2],raw:ne,base:0,top:oe[2],boxplot:oe})}else o.push({index:re,xValue:re,y:null,raw:ne,base:0,top:0})}return{points:o,hasExplicitX:s}}if("waterfall"===e.type){for(var se=0;se<a.length;se++){var le=a[se],he=null,ue=void 0;if("number"==typeof le)he=toNumber(le);else if(le&&"object"===_typeof(le)&&!Array.isArray(le)){var ce=le;he=toNumber(void 0===ce.value?ce.y:ce.value),void 0!==ce.name&&(ue=String(ce.name))}else he=toNumber(le);s=!0,o.push({index:se,xValue:void 0===ue?se:ue,y:he,raw:le,base:0,top:null===he?0:he,name:ue})}return{points:o,hasExplicitX:s}}if("treemap"===e.type){var de=[],fe=function visit(e,t){var i,r=_createForOfIteratorHelper(e.slice().sort(function(e,t){return treemapNodeValue(t)-treemapNodeValue(e)}));try{for(r.s();!(i=r.n()).done;){var n=i.value;de.push({node:n,depth:t}),Array.isArray(n&&n.children)&&n.children.length&&fe(n.children,t+1)}}catch(e){r.e(e)}finally{r.f()}};Array.isArray(e.data)&&fe(e.data,0);for(var pe=0;pe<de.length;pe++){var ve=de[pe].node,ye=treemapNodeValue(ve);o.push({index:pe,xValue:ve&&void 0!==ve.name?ve.name:pe,y:ye,raw:ve,base:0,top:ye,name:ve&&void 0!==ve.name?String(ve.name):String(pe)})}return{points:o,hasExplicitX:!0}}for(var me=0;me<a.length;me++){var xe=a[me],ge=me,be=null,ke=void 0,Se=!1;if(Array.isArray(xe)){if(ge=xe[0],be=toNumber(xe[1]),xe.length>2){var we=toNumber(xe[2]);ke=null===we?void 0:we}Se=!0}else if("number"==typeof xe||null===xe)be=toNumber(xe);else if(xe&&"object"===_typeof(xe)){var Ae=e.xField||"x",_e=e.yField||"y";if(void 0!==xe[Ae]?(ge=xe[Ae],Se=!0):void 0!==xe.x?(ge=xe.x,Se=!0):void 0!==xe.name&&"bar"===e.type&&(ge=xe.name,Se=!0),void 0!==xe[_e]?be=toNumber(xe[_e]):void 0!==xe.y?be=toNumber(xe.y):void 0!==xe.value&&(be=toNumber(xe.value)),void 0!==xe.size){var Me=toNumber(xe.size);ke=null===Me?void 0:Me}}Se&&(s=!0);var Ce=void 0;xe&&"object"===_typeof(xe)&&!Array.isArray(xe)&&void 0!==xe.name?Ce=String(xe.name):"pie"===e.type&&Array.isArray(xe)&&"string"==typeof xe[0]&&(Ce=xe[0]),o.push({index:me,xValue:ge,y:be,raw:xe,base:0,top:null===be?0:be,name:Ce,size:ke})}return{points:o,hasExplicitX:s}}function toNumber(e){if(function isNil(e){return null==e||"number"==typeof e&&isNaN(e)}(e))return null;var t=Number(e);return isFinite(t)?t:null}function applyCurveDomain(e,t,i){if("function"===t.type||"parametric"===t.type){var r,n=[],a=[],o=_createForOfIteratorHelper(e.points);try{for(o.s();!(r=o.n()).done;){var s=r.value.raw;s&&"object"===_typeof(s)&&("number"==typeof s.x&&a.push(s.x),"number"==typeof s.y&&n.push(s.y))}}catch(e){o.e(e)}finally{o.f()}var l=n.filter(function(e){return isFinite(e)});if(l.length&&(e.domainValues=robustRange(l)),"parametric"===t.type){var h=a.filter(function(e){return isFinite(e)});h.length&&(e.domainXValues=[Math.min.apply(Math,_toConsumableArray(h)),Math.max.apply(Math,_toConsumableArray(h))])}var u=t.params||{},c=[];if("function"===t.type)c=diagnoseExpression(String(t.expression||""),{variable:"x",params:u,values:n});else if(void 0!==t.polarExpression&&null!==t.polarExpression&&""!==String(t.polarExpression).trim()){var d,f=[],p=_createForOfIteratorHelper(e.points);try{for(p.s();!(d=p.n()).done;){var v=d.value.raw;v&&"object"===_typeof(v)&&"number"==typeof v.r&&f.push(v.r)}}catch(e){p.e(e)}finally{p.f()}c=diagnoseExpression(String(t.polarExpression),{variable:"t",params:u,values:f}).map(function(e){return _objectSpread2(_objectSpread2({},e),{},{message:"r(θ):".concat(e.message)})})}else{var m=String(t.xExpression||""),g=String(t.yExpression||""),b=expressionVariables(m),k=expressionVariables(g),S=function withPrefix(e,t){return e.map(function(e){return _objectSpread2(_objectSpread2({},e),{},{message:"".concat(t,":").concat(e.message)})})};c=[].concat(_toConsumableArray(S(diagnoseExpression(m,{variable:"t",params:u,values:a,additionalVariables:k}),"x(t)")),_toConsumableArray(S(diagnoseExpression(g,{variable:"t",params:u,values:n,additionalVariables:b}),"y(t)")))}if(c.length){e.expressionDiagnostics=c;var w=c.find(function(e){return"error"===e.severity});w&&(e.expressionError=w.message)}}}function expressionVariables(e){try{return compileExpression(e).variables}catch(e){return[]}}function buildYDomain(e,t,i,r){var n,a=[],o=!1,s=_createForOfIteratorHelper(e);try{for(s.s();!(n=s.n()).done;){var l=n.value;if(!l.hidden&&l.axisIndex===t)if("bar"!==l.type&&"area"!==l.type||(o=!0),l.domainValues&&l.domainValues.length){var h=_slicedToArray(robustRange(l.domainValues),2),u=h[0],c=h[1];a.push(u,c)}else{var d,f=_createForOfIteratorHelper(l.points);try{for(f.s();!(d=f.n()).done;){var p=d.value;null!==p.y&&a.push(p.y),p.ohlc&&a.push(p.ohlc[2],p.ohlc[3]),p.boxplot&&a.push(p.boxplot[0],p.boxplot[4]),l.option.stack&&(a.push(p.base),a.push(p.top)),"waterfall"===l.type&&a.push(p.base,p.top)}}catch(e){f.e(e)}finally{f.f()}}}}catch(e){s.e(e)}finally{s.f()}var v=_slicedToArray(extent(a),2),m=v[0],g=v[1];o&&(m=Math.min(m,0),g=Math.max(g,0));var b=isFiniteNumber(i.min),k=isFiniteNumber(i.max);if(b&&(m=i.min),k&&(g=i.max),!1!==i.nice&&"log"!==r){var S=_slicedToArray(niceDomain([m,g],i.tickCount||5),2);m=S[0],g=S[1]}if("log"!==r){var w=o&&!b&&Math.abs(m)<1e-12,A=o&&!k&&Math.abs(g)<1e-12,_=_slicedToArray(padDomain(m,g,i,b||w,k||A),2);m=_[0],g=_[1]}if("log"===r){var M=a.filter(function(e){return e>0});M.length?(m=Math.min.apply(Math,_toConsumableArray(M)),g=Math.max.apply(Math,_toConsumableArray(M))):(m=1,g=10),isFiniteNumber(i.min)&&i.min>0&&(m=i.min),isFiniteNumber(i.max)&&i.max>0&&(g=i.max)}return[round(m,10),round(g,10)]}function treemapNodeValue(e){if(!e)return 0;if(Array.isArray(e.children)&&e.children.length)return e.children.reduce(function(e,t){return e+treemapNodeValue(t)},0);var t=Number(e.value);return isFinite(t)&&t>0?t:0}function computeBoxplotSummary(e){var t=e.filter(function(e){return isFinite(e)}).sort(function(e,t){return e-t});if(!t.length)return[0,0,0,0,0];var i=function quantile(e){var i=(t.length-1)*e,r=Math.floor(i),n=Math.ceil(i);return r===n?t[r]:t[r]+(t[n]-t[r])*(i-r)};return[t[0],i(.25),i(.5),i(.75),t[t.length-1]]}function toSerializableOption(e){if(null==e)return e;if(Array.isArray(e))return e.map(toSerializableOption);if("function"!=typeof e){if("object"===_typeof(e)){var t={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var r=toSerializableOption(e[i]);void 0!==r&&(t[i]=r)}return t}return e}}function chartThemeToEnginePatch(e){var t=Array.isArray(e.colorPalette)&&e.colorPalette.length?e.colorPalette:["#0D6EFD"],i=function pick(e,i){return t[e]||t[0]||i};return{primary:i(0,"#0D6EFD"),success:i(1,"#198754"),warning:i(2,"#FFC107"),danger:i(3,"#DC3545"),info:i(4,"#0DCAF0"),text:e.textColor,muted:e.subTextColor,hint:e.axisLabelColor,border:e.axisLineColor,background:e.backgroundColor,palette:t,chrome:{selection:{stroke:e.selection.stroke},handle:{fill:i(0,"#0D6EFD")},linkHook:{fill:i(1,"#198754")},slot:{fill:i(1,"#198754"),hoverFill:i(2,"#FFC107")},guide:{color:i(0,"#0D6EFD")},linkLabel:{background:e.tooltip.background,fill:e.tooltip.textColor},textSelection:{color:e.brush.fill},shadow:{sm:e.tooltip.shadowColor,md:e.tooltip.shadowColor,lg:e.tooltip.shadowColor}},base:{fontFamily:{base:e.fontFamily},fontSize:{md:e.fontSize}}}}function applyChartThemeToEngine(e,t){if(!e||"function"!=typeof e.setTheme)throw new Error("applyChartThemeToEngine(ice, theme) 需要一个 ICE 实例");return e.setTheme(chartThemeToEnginePatch(t)),e}function formatNumberTick(e,t){if(!isFinite(e))return String(e);var i=Math.abs(e);if(0!==i&&(i>=1e9||i<1e-4))return e.toExponential(1);var r=0;t>0&&t<1?r=Math.min(6,Math.ceil(-Math.log10(t))):Number.isInteger(e)||(r=2);var n=e.toFixed(r),a=_slicedToArray((r>0?n.replace(/\.?0+$/,""):n).split("."),2),o=a[0],s=a[1],l=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");return s?"".concat(l,".").concat(s):l}function formatTick(e,t,i,r){if("function"==typeof r){var n=r(e,i);return null==n?"":String(n)}return"time"===t.type?t.format(e,i):"linear"===t.type||"log"===t.type?formatNumberTick(Number(e),function tickStep(e){for(var t=e.ticks(5),i=1/0,r=1;r<t.length;r++){var n=Math.abs(Number(t[r])-Number(t[r-1]));n>0&&n<i&&(i=n)}return isFinite(i)?i:0}(t)):String(e)}var C=function(){function LinearScale(e,t){_classCallCheck(this,LinearScale),_defineProperty(this,"type","linear"),this.domain=function normalize(e){var t=Number(e[0]),i=Number(e[1]);if(t===i){var r=Math.abs(t)>1?.1*Math.abs(t):1;return[t-r,i+r]}return[t,i]}(e),this.range=t}return _createClass(LinearScale,[{key:"map",value:function map(e){var t=Number(e);if(!isFinite(t))return NaN;var i=_slicedToArray(this.domain,2),r=i[0],n=i[1],a=_slicedToArray(this.range,2),o=a[0];return o+(t-r)/(n-r)*(a[1]-o)}},{key:"invert",value:function invert(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=_slicedToArray(this.range,2),a=n[0],o=n[1];return o===a?i:i+(e-a)/(o-a)*(r-i)}},{key:"ticks",value:function ticks(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=niceStep(r-i,e),a=[],o=Math.ceil(i/n)*n;o<=r+1e-6*n&&a.length<1e3;o+=n)a.push(round(o));return a}},{key:"bandwidth",value:function bandwidth(){return 0}},{key:"bandStart",value:function bandStart(e){return this.map(e)}},{key:"step",value:function step(){var e=this.ticks(5);return e.length>1?Math.abs(e[1]-e[0]):0}},{key:"isBand",value:function isBand(){return!1}},{key:"indexAt",value:function indexAt(e){return-1}},{key:"fractionOf",value:function fractionOf(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1];return r===i?0:(Number(e)-i)/(r-i)}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=_slicedToArray(this.domain,2),i=t[0];return i+e*(t[1]-i)}},{key:"span",value:function span(){return this.domain[1]-this.domain[0]}},{key:"format",value:function format(e,t){for(var i=this.ticks(5),r=1/0,n=1;n<i.length;n++){var a=Math.abs(i[n]-i[n-1]);a>0&&a<r&&(r=a)}return formatNumberTick(Number(e),isFinite(r)?r:0)}},{key:"clone",value:function clone(){return new LinearScale([this.domain[0],this.domain[1]],[this.range[0],this.range[1]])}}])}();var T=function(){function BandScale(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,BandScale),_defineProperty(this,"type","category"),this.domain=e.length?e.slice():[""],this.range=t,this.paddingInner=void 0===i.paddingInner?.2:i.paddingInner,this.paddingOuter=void 0===i.paddingOuter?.1:i.paddingOuter,this._step=this.computeStep()}return _createClass(BandScale,[{key:"computeStep",value:function computeStep(){var e=Math.max(1,this.domain.length),t=_slicedToArray(this.range,2),i=t[0],r=t[1],n=Math.abs(r-i),a=e-this.paddingInner+2*this.paddingOuter;return n/Math.max(1e-4,a)}},{key:"indexOf",value:function indexOf(e){var t=this.domain.indexOf(e);if(-1===t)for(var i=0;i<this.domain.length;i++)if(String(this.domain[i])===String(e))return i;return t}},{key:"map",value:function map(e){return this.bandStart(e)+this.bandwidth()/2}},{key:"bandStart",value:function bandStart(e,t){var i=void 0!==t&&t>=0?t:this.indexOf(e);return i<0?NaN:_slicedToArray(this.range,1)[0]+(this.range[1]>=this.range[0]?1:-1)*(this.paddingOuter*this._step+i*this._step)}},{key:"bandwidth",value:function bandwidth(){return this._step*(1-this.paddingInner)}},{key:"step",value:function step(){return this._step}},{key:"isBand",value:function isBand(){return!0}},{key:"ticks",value:function ticks(){return this.domain.slice()}},{key:"indexAt",value:function indexAt(e){for(var t=this.bandwidth(),i=this.range[1]>=this.range[0]?1:-1,r=0;r<this.domain.length;r++){var n=this.bandStart(void 0,r),a=n+i*t,o=Math.min(n,a),s=Math.max(n,a);if(e>=o&&e<=s)return r}return-1}},{key:"invert",value:function invert(e){var t=this.indexAt(e);if(t>=0)return this.domain[t];for(var i=0,r=1/0,n=0;n<this.domain.length;n++){var a=Math.abs(this.map(this.domain[n])-e);a<r&&(r=a,i=n)}return this.domain[i]}},{key:"nearestIndex",value:function nearestIndex(e){var t=this.indexAt(e);if(t>=0)return t;for(var i=0,r=1/0,n=0;n<this.domain.length;n++){var a=Math.abs(this.map(this.domain[n])-e);a<r&&(r=a,i=n)}return i}},{key:"fractionOf",value:function fractionOf(e){var t=this.indexOf(e);return t<0?0:this.domain.length<=1?.5:(t+.5)/this.domain.length}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=this.domain.length;if(t){var i=Math.max(0,Math.min(t-1,Math.round(e*t-.5)));return this.domain[i]}}},{key:"span",value:function span(){return this.domain.length}},{key:"format",value:function format(e){return null==e?"":String(e)}},{key:"clone",value:function clone(){return new BandScale(this.domain.slice(),[this.range[0],this.range[1]],{paddingInner:this.paddingInner,paddingOuter:this.paddingOuter})}}])}(),P=function(){function LogScale(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,LogScale),_defineProperty(this,"type","log"),this.base=i.logBase&&i.logBase>1?i.logBase:10;var r=Math.max(Number.MIN_VALUE,Number(e[0])),n=Math.max(1.0001*r,Number(e[1]));this.domain=[r,n],this.range=t}return _createClass(LogScale,[{key:"log",value:function log(e){return Math.log(e)/Math.log(this.base)}},{key:"map",value:function map(e){var t=Number(e);if(!(t>0))return NaN;var i=_slicedToArray(this.domain,2),r=i[0],n=i[1],a=_slicedToArray(this.range,2),o=a[0],s=a[1],l=this.log(r),h=this.log(n);return o+(this.log(t)-l)/(h-l)*(s-o)}},{key:"invert",value:function invert(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=_slicedToArray(this.range,2),a=n[0],o=n[1];if(o===a)return i;var s=this.log(i),l=s+(e-a)/(o-a)*(this.log(r)-s);return Math.pow(this.base,l)}},{key:"ticks",value:function ticks(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=[],a=Math.floor(this.log(i)),o=Math.ceil(this.log(r)),s=o-a;if(s<=2*e)for(var l=a;l<=o;l++){var h=Math.pow(this.base,l);h>=.999999*i&&h<=1.000001*r&&n.push(h)}else for(var u=Math.max(1,Math.ceil(s/e)),c=a;c<=o;c+=u){var d=Math.pow(this.base,c);d>=.999999*i&&d<=1.000001*r&&n.push(d)}return n.length||n.push(i,r),n}},{key:"bandwidth",value:function bandwidth(){return 0}},{key:"bandStart",value:function bandStart(e){return this.map(e)}},{key:"step",value:function step(){var e=this.ticks(5);return e.length>1?Math.abs(e[1]-e[0]):0}},{key:"isBand",value:function isBand(){return!1}},{key:"indexAt",value:function indexAt(e){return-1}},{key:"fractionOf",value:function fractionOf(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=this.log(i),a=this.log(r);return a===n?0:(this.log(Math.max(Number.MIN_VALUE,Number(e)))-n)/(a-n)}},{key:"valueAtFraction",value:function valueAtFraction(e){var t=_slicedToArray(this.domain,2),i=t[0],r=t[1],n=this.log(i),a=this.log(r);return Math.pow(this.base,n+e*(a-n))}},{key:"span",value:function span(){return this.domain[1]-this.domain[0]}},{key:"format",value:function format(e,t){return formatNumberTick(Number(e),this.step())}},{key:"clone",value:function clone(){return new LogScale([this.domain[0],this.domain[1]],[this.range[0],this.range[1]],{logBase:this.base})}}])}();function createScale(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};switch(e){case"category":return new T(t,i,r);case"time":return new v(t,i,r);case"log":return new P(t,i,r);default:return new C(t,i)}}function measureTextWidth(e,t,i,r){if(!t)return 0;if(e&&"function"==typeof e.measureText)try{var n=e.font;e.font="".concat(i,"px ").concat(r);var a=e.measureText(t);if(e.font=n,a&&"number"==typeof a.width&&isFinite(a.width))return a.width}catch(e){}for(var o=0,s=0;s<t.length;s++){o+=t.charCodeAt(s)>11904?1:.55}return o*i}function computeLayout(e,t,i){for(var r=e.option.margin,n=createScale(e.xAxis.type,e.xAxis.domain,[0,Math.max(1,i.width)],{logBase:e.xAxis.option.logBase}),a=buildAxisLayout(e,"x",e.xAxis,n,t),o=e.yAxes.map(function(r){var n=createScale(r.type,r.domain,[Math.max(1,i.height),0],{logBase:r.option.logBase});return buildAxisLayout(e,"y",r,n,t)}),s=0,l=0,h=0;h<e.yAxes.length;h++){var u=e.yAxes[h],c=o[h];if(!1!==u.option.show&&"cartesian"===e.kind){var d=yAxisReserve(u,c);"right"===u.position?(c.offset=l,l+=d):(c.offset=s,s+=d)}else c.offset=0}var f=o[0],p=function buildTitleLayout(e){var t=e.option.title;if(!t||!t.text&&!t.subtext)return null;var i=e.theme,r={color:t.textStyle&&t.textStyle.color||i.textColor,fontSize:t.textStyle&&t.textStyle.fontSize||i.fontSize+4,fontWeight:t.textStyle&&t.textStyle.fontWeight||"bold"},n={color:t.subtextStyle&&t.subtextStyle.color||i.subTextColor,fontSize:t.subtextStyle&&t.subtextStyle.fontSize||i.fontSize},a="left"===t.left?"left":"right"===t.left?"right":"center";return{text:t.text||"",subtext:t.subtext||"",x:0,y:0,align:a,textStyle:r,subtextStyle:n}}(e),v=p?(p.text?1.5*p.textStyle.fontSize:0)+(p.subtext?1.4*p.subtextStyle.fontSize:0):0,m=function layoutLegend(e,t,i,r){var n=e.option.legend;if(!n||!1===n.show)return null;var a=[];if("polar"===e.kind||"funnel"===e.kind){var o,s=_createForOfIteratorHelper(e.series);try{for(s.s();!(o=s.n()).done;){var l=o.value;if("pie"===l.type||"funnel"===l.type){var h,u=_createForOfIteratorHelper(l.points);try{for(u.s();!(h=u.n()).done;){var c=h.value;a.push({seriesId:l.id,seriesIndex:l.index,dataIndex:c.index,name:c.name||"".concat(l.name," ").concat(c.index+1),color:c.color||l.color,hidden:!!e.hiddenSlices["".concat(l.id,"#").concat(c.index)],x:0,y:0,width:0,height:0})}}catch(e){u.e(e)}finally{u.f()}}}}catch(e){s.e(e)}finally{s.f()}}else{var d,f=_createForOfIteratorHelper(e.series);try{for(f.s();!(d=f.n()).done;){var p=d.value;a.push({seriesId:p.id,seriesIndex:p.index,name:p.name,color:p.color,hidden:!!p.hidden,x:0,y:0,width:0,height:0})}}catch(e){f.e(e)}finally{f.f()}}if(!a.length)return null;var v={position:n.position||"top",items:a},m=e.theme.fontSize,g=n.itemWidth||12,b=Math.max(n.itemHeight||12,1.4*m),k=n.itemGap||16,S=a.map(function(i){return{item:i,textWidth:measureTextWidth(t,i.name,m,e.theme.fontFamily)}}),w=b+4,A=e.option.margin;if("left"===v.position||"right"===v.position){for(var _=Math.max.apply(Math,_toConsumableArray(S.map(function(e){return e.textWidth})).concat([0])),M=S.length*w,C="left"===v.position?A.left:i.width-A.right-(g+6+_),T=Math.max(0,i.height-r-A.bottom),P=Math.max(r,r+(T-M)/2),I=0;I<S.length;I++){var O=S[I].item;O.x=C,O.y=P+I*w,O.width=g+6+S[I].textWidth,O.height=w}return v}var N,D=[],H=[],R=0,E=Math.max(40,i.width-A.left-A.right),L=_createForOfIteratorHelper(S);try{for(L.s();!(N=L.n()).done;){var z=N.value,B=g+6+z.textWidth;H.length&&R+k+B>E&&(D.push(H),H=[],R=0),R+=(H.length>1?k:0)+B,H.push(z)}}catch(e){L.e(e)}finally{L.f()}H.length&&D.push(H);for(var W="top"===v.position?r:i.height-A.bottom-D.length*w,V=0,j=D;V<j.length;V++){var U,X=j[V],K=X.reduce(function(e,t,i){return e+g+6+t.textWidth+(i>0?k:0)},0),G=(i.width-K)/2,Y=_createForOfIteratorHelper(X);try{for(Y.s();!(U=Y.n()).done;){var q=U.value;q.item.x=G,q.item.y=W,q.item.width=g+6+q.textWidth,q.item.height=w,G+=q.item.width+k}}catch(e){Y.e(e)}finally{Y.f()}W+=w}return v}(e,t,i,r.top+v),g=m?function legendSizeOf(e,t){var i=t.option.legend,r=t.theme.fontSize,n=i.itemWidth||12,a=Math.max(i.itemHeight||12,1.4*r)+4;if("left"===e.position||"right"===e.position){var o=e.items.map(function(e){return e.x}),s=e.items.map(function(e){return e.x+e.width}),l=o.length?Math.min.apply(Math,_toConsumableArray(o)):0,h=s.length?Math.max.apply(Math,_toConsumableArray(s)):0;return{width:Math.max(n+6,h-l),height:e.items.length*a}}var u,c=1,d=e.items.length?e.items[0].y:0,f=_createForOfIteratorHelper(e.items);try{for(f.s();!(u=f.n()).done;){var p=u.value;p.y>d&&(c+=1,d=p.y)}}catch(e){f.e(e)}finally{f.f()}return{width:0,height:c*a}}(m,e):{width:0,height:0},b=r.left,k=r.top,S=i.width-r.right,w=i.height-r.bottom;k+=v,m&&("top"===m.position?k+=g.height+8:"bottom"===m.position?w-=g.height+8:"left"===m.position?b+=g.width+8:S-=g.width+8),b+=s,S-=l,"cartesian"===e.kind&&!1!==e.xAxis.option.show&&(w-=a.labelHeight+4+6,e.xAxis.option.name&&(w-=a.nameHeight+6));var A=e.option.dataZoom&&e.option.dataZoom.slider,_=!("cartesian"!==e.kind||!e.option.dataZoom||A&&!1===A.show),M=Math.max(12,Number(A&&A.height)||26),C=null;if(_){var T=i.height-r.bottom,P=M+14;w+P>T&&(w-=w+P-T),C=w+14}var I={x:Math.round(Math.max(0,b)),y:Math.round(Math.max(0,k)),width:Math.max(1,Math.round(S-b)),height:Math.max(1,Math.round(w-k))},O=null;if("polar"===e.kind||"radar"===e.kind||"gauge"===e.kind||"liquid"===e.kind){var N,D=Math.min(I.width,I.height)/2,H=I.width/2,R=I.height/2,E="polar"===e.kind&&e.series.some(function(e){return"pie"===e.type&&!(e.option.label&&!1===e.option.label.show)})?Math.min(46,.26*D):6;N="gauge"===e.kind?Math.max(10,.94*Math.min(H-14,R-4)):"liquid"===e.kind?Math.max(10,Math.min(H,R)-3):Math.max(10,D*function polarRadiusRatio(e){if("radar"===e.kind){var t=Number(e.radar&&e.radar.radius);return isFinite(t)&&t>0?Math.max(.1,Math.min(1,t)):.72}var i,r=_createForOfIteratorHelper(e.series);try{for(r.s();!(i=r.n()).done;){var n=i.value;if("pie"===n.type){var a=Number(n.option.radius);if(isFinite(a)&&a>0)return Math.max(.1,Math.min(1,a))}}}catch(e){r.e(e)}finally{r.f()}return.92}(e)-E);var L=I.x+I.width/2,z=I.y+I.height/2;O={cx:L,cy:z,radius:N},I={x:Math.round(L-N),y:Math.round(z-N),width:Math.round(2*N),height:Math.round(2*N)}}if("cartesian"===e.kind&&"equal"===e.option.aspect){var B=Math.min(I.width,I.height);I={x:Math.round(I.x+(I.width-B)/2),y:Math.round(I.y+(I.height-B)/2),width:Math.round(B),height:Math.round(B)}}p&&(p.y=r.top);var W=_&&null!==C?{x:I.x,y:Math.round(C),width:I.width,height:Math.round(M)}:null;return{canvas:i,plot:I,titleRect:p?{x:p.x,y:p.y,width:0,height:v}:null,legendRect:m?legendBoundingRect(m):null,legend:m,title:p,polar:O,slider:W,xAxisLayout:a,yAxes:o,yAxisLayout:f,margin:r}}function yAxisReserve(e,t){var i=t.labelWidth+4+6;return e.option.name&&(i+=t.nameHeight+6),i}function buildAxisLayout(e,t,i,r,n){var a=i.option,o=e.theme.fontSize,s=e.theme.fontFamily;if(!1===a.show)return{ticks:[],labels:[],offset:0,labelWidth:0,labelHeight:0,nameWidth:0,nameHeight:0};for(var l=r.ticks(a.tickCount||5),h=[],u=0,c=0;c<l.length;c++){var d=formatTick(l[c],r,c,a.formatter);h.push(d);var f=measureTextWidth(n,d,o,s);f>u&&(u=f)}if("x"===t&&l.length>2&&u>0){var p="function"==typeof r.range?r.range():r.range,v=p&&p.length>=2?Math.abs(p[1]-p[0]):0;if(v>0){var m=v/(l.length-1||1),g=Math.max(u+10,64);if(m<g)for(var b=Math.ceil(g/m),k=0;k<h.length;k++)k%b!==0&&(h[k]="")}}var S=Math.abs(Number(a.labelRotate)||0),w=S*Math.PI/180,A=u*Math.sin(w)+1.4*o,_=a.name||"",M=_?measureTextWidth(n,_,o,s):0;return{ticks:l,labels:h,offset:0,labelWidth:"y"===t?u:0,labelHeight:"x"===t?S>0?A:1.4*o:0,nameWidth:"x"===t?M:0,nameHeight:_?1.4*o:0}}function legendBoundingRect(e){if(!e.items.length)return{x:0,y:0,width:0,height:0};var t,i=1/0,r=1/0,n=-1/0,a=-1/0,o=_createForOfIteratorHelper(e.items);try{for(o.s();!(t=o.n()).done;){var s=t.value;i=Math.min(i,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x+s.width),a=Math.max(a,s.y+s.height)}}catch(e){o.e(e)}finally{o.f()}return{x:i,y:r,width:n-i,height:a-r}}var I=function(){function ChartComponent(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ChartComponent),_defineProperty(e=_callSuper(this,ChartComponent,[_objectSpread2({origin:"top-left",fill:!1,stroke:!1,draggable:!1,transformable:!1,linkable:!1,interactive:!1},t)]),"loopRegistered",!1),e}return _inherits(ChartComponent,e.ICEComponent),_createClass(ChartComponent,[{key:"keyboardEvtHandler",value:function keyboardEvtHandler(){}},{key:"containsLocalPoint",value:function containsLocalPoint(e,t){return e>=0&&t>=0&&e<=this.state.width&&t<=this.state.height}},{key:"unit",value:function unit(){var e=this.ice;return e?1/((e.viewport&&e.viewport.scale||1)*(e.dpr||1)):1}},{key:"snap",value:function snap(e){var t=this.ice;if(!t)return e;var i=(t.viewport&&t.viewport.scale||1)*(t.dpr||1);return Math.round(e*i)/i+.5/i}},{key:"markDirty",value:function markDirty(){return this.dirty=!0,this.ice&&(this.ice.dirty=!0),this}},{key:"keepAnimating",value:function keepAnimating(){if(!this.loopRegistered){this.loopRegistered=!0;var e=_objectSpread2(_objectSpread2({},this.props.animations||{}),{},{__tick:{from:0,to:1,duration:100,loop:!0}});this.props.animations=e,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}}},{key:"stopAnimating",value:function stopAnimating(){if(this.loopRegistered){this.loopRegistered=!1;var e=_objectSpread2({},this.props.animations||{});for(var t in e)e[t]&&(e[t].finished=!0);delete e.__tick,this.props.animations=e,this.ice&&this.ice.animationManager&&this.ice.animationManager.remove(this)}}},{key:"setFont",value:function setFont(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal";this.ctx.font="".concat(i," ").concat(e,"px ").concat(t)}}])}(),O="auto";function shouldAnimate(){return"instant"!==O&&("full"===O||!function prefersReducedMotion(){if("undefined"==typeof window||"function"!=typeof window.matchMedia)return!1;try{return!!window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch(e){return!1}}())}var N=function(){function Axis(e){var t;return _classCallCheck(this,Axis),_defineProperty(t=_callSuper(this,Axis,[_objectSpread2({interactive:!1},e)]),"axisIndex",0),_defineProperty(t,"position","left"),_defineProperty(t,"axis",null),_defineProperty(t,"layout",null),_defineProperty(t,"theme",null),_defineProperty(t,"lastTicks",[]),_defineProperty(t,"morphFrom",[]),t.orientation=e.orientation,t.axisIndex=e.axisIndex||0,t.position=e.position||"left",t}return _inherits(Axis,I),_createClass(Axis,[{key:"edgeX",value:function edgeX(e){var t=this.layout.plot,i=e.offset||0;return"left"===this.position?t.x-i:t.x+t.width+i}},{key:"axisLayoutOf",value:function axisLayoutOf(e){return"x"===this.orientation?e.xAxisLayout:e.yAxes[this.axisIndex]||e.yAxisLayout}},{key:"tickEntries",value:function tickEntries(){var e=this.axis,t=this.layout;if(!e||!t||!e.scale)return null;var i=e.option||{},r=e.scale,n=t.plot,a=this.axisLayoutOf(t),o=a.ticks,s=this.theme?this.theme.fontSize:12,l=this.theme?this.theme.fontFamily:"sans-serif",h=1;if("x"===this.orientation&&o.length>1){var u,c=0,d=_createForOfIteratorHelper(a.labels);try{for(d.s();!(u=d.n()).done;){var f=u.value,p=measureTextWidth(this.ctx,f,s,l);p>c&&(c=p)}}catch(e){d.e(e)}finally{d.f()}var v=n.width/o.length,m=Math.max(c+8,64);m>v&&(h=Math.ceil(m/Math.max(1,v)))}for(var g=[],b=0;b<o.length;b++){var k=r.map(o[b]),S="x"===this.orientation?n.x+k:n.y+k;if(isFinite(S)){var w=formatTick(o[b],r,b,i.formatter)||"",A=b===o.length-1,_=!(!w||h>1&&b%h!==0&&!A);g.push({key:String(o[b]),pos:S,label:w,drawn:_})}}return g}},{key:"morphProgress",value:function morphProgress(){var e=Number(this.state.axisMorph);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"renderedPositions",value:function renderedPositions(){var e,t=this,i=this.morphProgress(),r=new Map,n=_createForOfIteratorHelper(this.lastTicks);try{var a=function _loop(){var n=e.value,a=t.morphFrom.find(function(e){return e.key===n.key});r.set(n.key,a?a.pos+(n.pos-a.pos)*i:n.pos)};for(n.s();!(e=n.n()).done;)a()}catch(e){n.e(e)}finally{n.f()}return r}},{key:"syncTicks",value:function syncTicks(){var e=this,t=this.tickEntries();if(t&&!(t.length===this.lastTicks.length&&t.every(function(t,i){return t.key===e.lastTicks[i].key&&Math.abs(t.pos-e.lastTicks[i].pos)<.01}))){var i=0===this.lastTicks.length,r=this.renderedPositions();if(this.morphFrom=this.lastTicks.map(function(e){var t;return _objectSpread2(_objectSpread2({},e),{},{pos:null!==(t=r.get(e.key))&&void 0!==t?t:e.pos})}),this.lastTicks=t,this.setState({axisMorph:0}),i||!shouldAnimate())return this.setState({axisMorph:1}),void this.markDirty();var n=_objectSpread2({},this.props.animations||{});n.axisMorph={from:0,to:1,duration:240,easing:"easeOutCubic",startTime:void 0,finished:!1},this.props.animations=n,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}}},{key:"renderedTickPos",value:function renderedTickPos(e){var t=String(e),i=this.morphFrom.find(function(e){return e.key===t}),r=this.lastTicks.find(function(e){return e.key===t});return i&&r?i.pos+(r.pos-i.pos)*this.morphProgress():r?r.pos:i?i.pos:null}},{key:"morphing",value:function morphing(){return this.morphProgress()<1}},{key:"drawTick",value:function drawTick(e,t,i,r,n){if(!1!==n.showTick){var a=this.ctx;if(a.beginPath(),"x"===this.orientation)a.moveTo(e,t.y+t.height),a.lineTo(e,t.y+t.height+4*r);else{var o="left"===this.position?-1:1;a.moveTo(i,e),a.lineTo(i+4*o*r,e)}a.stroke()}}},{key:"drawTickLabel",value:function drawTickLabel(e,t,i,r,n,a){if(t){var o=this.ctx;if("x"!==this.orientation){var s="left"===this.position?-1:1;o.fillText(t,r+s*n,e)}else{var l=i.y+i.height+n;a.labelRotate?(o.save(),o.translate(e,l),o.rotate(Number(a.labelRotate)*Math.PI/180),o.textAlign="right",o.textBaseline="middle",o.fillText(t,0,0),o.restore()):o.fillText(t,e,l)}}}},{key:"doRender",value:function doRender(){if(this.axis&&this.layout&&this.theme){var e=this.axis.option;if(!1!==e.show)if(this.axis.scale){var t=this.layout.plot,i="x"===this.orientation?this.layout.xAxisLayout:this.layout.yAxes[this.axisIndex]||this.layout.yAxisLayout,r=this.ctx,n=this.theme.fontSize,a=this.unit(),o=10*a;r.beginPath(),r.save(),r.lineWidth=a,r.strokeStyle=this.theme.axisLineColor,r.fillStyle=this.theme.axisLabelColor,this.setFont(n,this.theme.fontFamily),r.textBaseline="x"===this.orientation?"top":"middle",r.textAlign="x"===this.orientation?"center":"left"===this.position?"right":"left";var s="x"===this.orientation?t.x:this.edgeX(i);if(!1!==e.showAxisLine){if(r.beginPath(),"x"===this.orientation){var l=this.snap(t.y+t.height);r.moveTo(t.x,l),r.lineTo(t.x+t.width,l)}else{var h=this.snap(s);r.moveTo(h,t.y),r.lineTo(h,t.y+t.height)}r.stroke()}var u,c="left"===this.position?-1:1,d=this.tickEntries()||[],f=this.morphProgress(),p=new Map,v=_createForOfIteratorHelper(this.morphFrom);try{for(v.s();!(u=v.n()).done;){var m=u.value;p.set(m.key,m.pos)}}catch(e){v.e(e)}finally{v.f()}var g=new Set(d.map(function(e){return e.key}));if(f<1){r.fillStyle=this.theme.axisLabelColor,r.globalAlpha=(1-f)*(1-f);var b,k=_createForOfIteratorHelper(this.morphFrom);try{for(k.s();!(b=k.n()).done;){var S=b.value;!g.has(S.key)&&S.drawn&&(this.drawTick(S.pos,t,s,a,e),this.drawTickLabel(S.pos,S.label,t,s,o,e))}}catch(e){k.e(e)}finally{k.f()}r.globalAlpha=1}var w,A=_createForOfIteratorHelper(d);try{for(A.s();!(w=A.n()).done;){var _=w.value,M=p.get(_.key),C=void 0===M?_.pos:M+(_.pos-M)*f;r.globalAlpha=void 0===M?Math.min(1,.15+.85*f):1,this.drawTick(C,t,s,a,e),_.drawn&&this.drawTickLabel(C,_.label,t,s,o,e)}}catch(e){A.e(e)}finally{A.f()}if(r.globalAlpha=1,e.name)if(this.setFont(n,this.theme.fontFamily),r.fillStyle=this.theme.subTextColor,"x"===this.orientation)if(r.textAlign="center",r.textBaseline="middle",this.layout.slider)r.textAlign="right",r.textBaseline="bottom",r.fillText(e.name,t.x+t.width,t.y+t.height-4*a);else{var T=t.y+t.height+o+i.labelHeight+6*a+.5*n;r.fillText(e.name,t.x+t.width/2,T)}else{var P=s+c*(i.labelWidth+o+i.nameHeight+4*a);r.save(),r.translate("left"===this.position?Math.max(.6*n,P):P,t.y+t.height/2),r.rotate(-Math.PI/2),r.textAlign="center",r.textBaseline="middle",r.fillText(e.name,0,0),r.restore()}r.restore()}}}}])}(),D=function(){function GridLines(e){var t;return _classCallCheck(this,GridLines),_defineProperty(t=_callSuper(this,GridLines,[_objectSpread2({interactive:!1},e)]),"xScale",null),_defineProperty(t,"yScale",null),_defineProperty(t,"horizontal",[]),_defineProperty(t,"plot",{x:0,y:0,width:0,height:0}),_defineProperty(t,"grid",{}),_defineProperty(t,"theme",null),_defineProperty(t,"axisX",null),_defineProperty(t,"axisYList",[]),t}return _inherits(GridLines,I),_createClass(GridLines,[{key:"syncTicks",value:function syncTicks(){if([this.axisX].concat(_toConsumableArray(this.axisYList)).filter(Boolean).some(function(e){return"function"==typeof e.morphing&&e.morphing()})){var e=_objectSpread2({},this.props.animations||{});e.axisMorph={from:0,to:1,duration:240,easing:"easeOutCubic",startTime:void 0,finished:!1},this.props.animations=e,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}}},{key:"yTickPos",value:function yTickPos(e,t,i){var r=void 0===e?null:this.axisYList[e];if(!r||"function"!=typeof r.renderedTickPos)return i;var n=r.renderedTickPos(t);return null==n?i:n}},{key:"xTickPos",value:function xTickPos(e,t){var i=this.axisX;if(!i||"function"!=typeof i.renderedTickPos)return t;var r=i.renderedTickPos(e);return null==r?t:r}},{key:"doRender",value:function doRender(){var e=this;if(this.theme&&this.xScale&&this.yScale&&!1!==this.grid.show){var t=this.plot,i=this.ctx;i.beginPath(),i.save(),i.strokeStyle=this.grid.color||this.theme.splitLineColor,i.lineWidth=(this.grid.lineWidth||1)*this.unit(),"function"==typeof i.setLineDash&&i.setLineDash((this.grid.lineDash||[]).map(function(t){return t*e.unit()}));var r=this.horizontal.length?this.horizontal:this.yScale?[{scale:this.yScale,ticks:this.yScale.ticks(5)}]:[];if(!1!==this.grid.y){i.beginPath();var n,a=_createForOfIteratorHelper(r);try{for(a.s();!(n=a.n()).done;){var o,s=n.value,l=_createForOfIteratorHelper(s.ticks);try{for(l.s();!(o=l.n()).done;){var h=o.value,u=t.y+s.scale.map(h);if(isFinite(u)){var c=this.snap(this.yTickPos(s.index,h,u));i.moveTo(t.x,c),i.lineTo(t.x+t.width,c)}}}catch(e){l.e(e)}finally{l.f()}}}catch(e){a.e(e)}finally{a.f()}i.stroke()}if(this.grid.x){i.beginPath();var d,f=_createForOfIteratorHelper(this.xScale.ticks(5));try{for(f.s();!(d=f.n()).done;){var p=d.value,v=t.x+this.xScale.map(p);if(isFinite(v)){var m=this.snap(this.xTickPos(p,v));i.moveTo(m,t.y),i.lineTo(m,t.y+t.height)}}}catch(e){f.e(e)}finally{f.f()}i.stroke()}i.restore()}}}])}(),H=[6,4];function resolveAxisValue(e,t,i,r){if(null==t||""===t)return{ok:!1,code:"annotation:invalid-value",message:"".concat(r," 标注缺少定位值。")};var n=e.scale;if(!n||"function"!=typeof n.map)return{ok:!1,code:"annotation:unsupported-scene",message:"当前场景没有可用于定位的坐标系。"};var a,o=n.domain||[],s=t;if("category"===e.type){var l=o.indexOf(s);if(l<0&&(l=o.findIndex(function(e){return String(e)===String(s)})),l<0){var h=Number(s);if(!(Number.isInteger(h)&&h>=0&&h<o.length))return{ok:!1,code:"annotation:unknown-category",message:"".concat(r," 轴没有类目「").concat(String(t),"」。")};l=h}s=o[l];var u=Number(n.map(s));return isFinite(u)?{ok:!0,pixel:i+u,inside:!0,label:String(s)}:{ok:!1,code:"annotation:unknown-category",message:"".concat(r," 轴定位不到「").concat(String(t),"」。")}}if("time"===e.type){if(a=toTimestamp(s),!isFinite(a))return{ok:!1,code:"annotation:invalid-value",message:"".concat(r," 标注的「").concat(String(t),"」不是合法时间。")}}else if(a=Number(s),!isFinite(a))return{ok:!1,code:"annotation:invalid-value",message:"".concat(r," 标注的「").concat(String(t),"」不是合法数值。")};var c=Number(n.map(a));if(!isFinite(c))return{ok:!1,code:"annotation:out-of-range",message:"".concat(r," 标注的「").concat(String(t),"」无法定位。")};var d=function domainRange(e){if(!e||!e.length)return[null,null];var t=e.map(function(e){return Number(e)});if(t.length&&t.every(function(e){return isFinite(e)}))return[Math.min.apply(Math,_toConsumableArray(t)),Math.max.apply(Math,_toConsumableArray(t))];return[0,e.length-1]}(o),f=_slicedToArray(d,2),p=f[0],v=f[1];return{ok:!0,pixel:i+c,inside:null===p||null===v||a>=p-1e-9&&a<=v+1e-9,label:String(t)}}function pickAxis(e,t,i){if("x"===t)return e.xAxis;var r=Number.isInteger(i)&&Number(i)>=0?Number(i):0;return e.yAxes[r]||e.yAxes[0]||e.xAxis}function positiveNumber(e,t){var i=Number(e);return isFinite(i)&&i>0?i:t}function textPosition(e,t){return"start"===e||"center"===e||"end"===e?e:t}function pointTextPosition(e){return"bottom"===e||"left"===e||"right"===e||"top"===e?e:"top"}function resolvedLineDash(e){return Array.isArray(e.lineDash)?e.lineDash.filter(function(e){return isFinite(Number(e))&&Number(e)>=0}).map(Number):!1===e.dashed?[]:H}function symbolOf(e){return"rect"===e||"diamond"===e||"triangle"===e?e:"circle"}function clamp$1(e,t,i){return Math.max(t,Math.min(i,e))}function plainText(e){return null==e?"":String(e)}function withAlpha(e,t){if("string"!=typeof e)return"rgba(0,0,0,".concat(t,")");if("#"===e.charAt(0)){var i=e.slice(1);if(3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),6!==i.length)return e;var r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return"rgba(".concat(r,",").concat(n,",").concat(a,",").concat(t,")")}return 0===e.indexOf("rgb(")?e.replace("rgb(","rgba(").replace(")",",".concat(t,")")):e}function resolveAnnotation(e,t){var i={lines:[],points:[],areas:[]},r=[];if(!e||"object"!==_typeof(e))return{resolved:i,diagnostics:r};var n=Array.isArray(e.lines)?e.lines:[],a=Array.isArray(e.points)?e.points:[],o=Array.isArray(e.areas)?e.areas:[];if(!(n.length+a.length+o.length))return{resolved:i,diagnostics:r};if("cartesian"!==t.kind)return r.push({code:"annotation:unsupported-scene",severity:"warning",message:"标注需要直角坐标系(x / y 轴),当前场景没有,已跳过全部标注。",kind:"line",index:0}),{resolved:i,diagnostics:r};for(var s=t.theme,l=s.textColor,h=s.fontSize||12,u=0;u<o.length;u++){var c=o[u]||{},d="x"===c.axis?"x":"y",f="x"===d?"x":"y",p=pickAxis(t,d,c.axisIndex),v="x"===d?t.plot.x:t.plot.y,m="x"===d?t.plot.width:t.plot.height,g=resolveAxisValue(p,c.from,v,f),b=resolveAxisValue(p,c.to,v,f);if(g.ok&&b.ok){var k=v,S=v+m,w=clamp$1(g.pixel,k,S),A=clamp$1(b.pixel,k,S);Math.abs(A-w)<=0?r.push({code:"annotation:out-of-range",severity:"warning",message:"标注区间#".concat(u,":区间「").concat(plainText(c.from)," ~ ").concat(plainText(c.to),"」不在当前可视范围内,已跳过。"),kind:"area",index:u}):i.areas.push({kind:"area",index:u,axis:d,axisIndex:Number.isInteger(c.axisIndex)?Number(c.axisIndex):0,from:w,to:A,color:"string"==typeof c.color&&c.color?c.color:withAlpha(l,.1),text:plainText(c.text),textPosition:textPosition(c.textPosition,"center"),textColor:"string"==typeof c.textColor&&c.textColor?c.textColor:l,fontSize:positiveNumber(c.fontSize,h)})}else pushDiagnostic(r,g.ok?b:g,"area",u)}for(var _=0;_<n.length;_++){var M=n[_]||{},C="x"===M.axis?"x":"y",T="x"===C?"x":"y",P=pickAxis(t,C,M.axisIndex),I="x"===C?t.plot.x:t.plot.y,O=resolveAxisValue(P,M.value,I,T);if(O.ok)if(O.inside){var N="string"==typeof M.color&&M.color?M.color:l;i.lines.push({kind:"line",index:_,axis:C,axisIndex:Number.isInteger(M.axisIndex)?Number(M.axisIndex):0,pixel:O.pixel,text:plainText(M.text),color:N,lineWidth:positiveNumber(M.lineWidth,1),lineDash:resolvedLineDash(M),textPosition:textPosition(M.textPosition,"end"),textColor:"string"==typeof M.textColor&&M.textColor?M.textColor:N,fontSize:positiveNumber(M.fontSize,h)})}else pushDiagnostic(r,{ok:!1,code:"annotation:out-of-range",message:"".concat(T," 标注的「").concat(O.label,"」不在当前可视范围内,已跳过。")},"line",_);else pushDiagnostic(r,O,"line",_)}for(var D=0;D<a.length;D++){var H=a[D]||{},R=resolveAxisValue(t.xAxis,H.x,t.plot.x,"x"),E=resolveAxisValue(pickAxis(t,"y",H.axisIndex),H.y,t.plot.y,"y");if(R.ok&&E.ok&&R.inside&&E.inside){var L="string"==typeof H.color&&H.color?H.color:l;i.points.push({kind:"point",index:D,axisIndex:Number.isInteger(H.axisIndex)?Number(H.axisIndex):0,x:R.pixel,y:E.pixel,text:plainText(H.text),color:L,symbol:symbolOf(H.symbol),symbolSize:positiveNumber(H.symbolSize,8),textPosition:pointTextPosition(H.textPosition),textColor:"string"==typeof H.textColor&&H.textColor?H.textColor:L,fontSize:positiveNumber(H.fontSize,h)})}else{pushDiagnostic(r,R.ok?E.ok?R.inside?{ok:!1,code:"annotation:out-of-range",message:"y 标注的「".concat(E.label,"」不在当前可视范围内,已跳过。")}:{ok:!1,code:"annotation:out-of-range",message:"x 标注的「".concat(R.label,"」不在当前可视范围内,已跳过。")}:E:R,"point",D)}}return{resolved:i,diagnostics:r}}function pushDiagnostic(e,t,i,r){var n="line"===i?"标注线":"point"===i?"标注点":"标注区间";e.push({code:t.code,severity:"annotation:invalid-value"===t.code?"error":"warning",message:"".concat(n,"#").concat(r,":").concat(t.message),kind:i,index:r})}var R=function(){function Annotation(e){var t;return _classCallCheck(this,Annotation),_defineProperty(t=_callSuper(this,Annotation,[_objectSpread2({interactive:!1},e)]),"resolved",{lines:[],points:[],areas:[]}),_defineProperty(t,"diagnostics",[]),_defineProperty(t,"ink",[]),_defineProperty(t,"theme",null),_defineProperty(t,"option",null),_defineProperty(t,"__boxScratch",[0,0,0,0]),_defineProperty(t,"plot",{x:0,y:0,width:0,height:0}),_defineProperty(t,"xAxis",null),_defineProperty(t,"yAxes",[]),t}return _inherits(Annotation,I),_createClass(Annotation,[{key:"sync",value:function sync(e,t){this.option=e||null,this.theme=t.theme;var i=resolveAnnotation(e,t),r=i.resolved,n=i.diagnostics;this.resolved=r,this.diagnostics=n,this.markDirty()}},{key:"hasInk",get:function get(){return this.resolved.lines.length>0||this.resolved.points.length>0||this.resolved.areas.length>0}},{key:"__localBox",value:function __localBox(){var e=this.__boxScratch;return e[0]=0,e[1]=0,e[2]=this.state.width||0,e[3]=this.state.height||0,e}},{key:"doRender",value:function doRender(){if(this.theme&&this.hasInk){var e=this.plot,t=[];this.drawAreas(t,e),this.drawLines(t,e),this.drawPoints(t),this.ink=t}else this.ink=[]}},{key:"drawAreas",value:function drawAreas(e,t){var i,r=this,n=_createForOfIteratorHelper(this.resolved.areas);try{var a=function _loop(){var n=i.value,a=r.ctx;a.beginPath();var o=Math.min(n.from,n.to),s=Math.max(n.from,n.to),l="x"===n.axis?o:t.x,h="y"===n.axis?o:t.y,u="x"===n.axis?s-o:t.width,c="y"===n.axis?s-o:t.height;if(u<=0||c<=0)return 1;a.save(),a.fillStyle=n.color,a.fillRect(l,h,u,c),a.restore();var d=null;if(n.text){a.save(),r.setFont(n.fontSize,r.theme.fontFamily,"normal"),a.fillStyle=n.textColor;if("y"===n.axis){var f="start"===n.textPosition?"left":"end"===n.textPosition?"right":"center",p="start"===n.textPosition?t.x+6:"end"===n.textPosition?t.x+t.width-6:t.x+t.width/2;a.textAlign=f,a.textBaseline="middle";var v=(n.from+n.to)/2;r.strokeHalo(function(){return a.strokeText(n.text,p,v)}),a.fillText(n.text,p,v),d={kind:"area",index:n.index,x:"right"===f?p-r.textWidth(n.text,n.fontSize):"center"===f?p-r.textWidth(n.text,n.fontSize)/2:p,y:v-n.fontSize/2,width:r.textWidth(n.text,n.fontSize),height:n.fontSize,text:n.text}}else{var m=(n.from+n.to)/2;a.textAlign="center",a.textBaseline="top";var g=t.y+6;r.strokeHalo(function(){return a.strokeText(n.text,m,g)}),a.fillText(n.text,m,g),d={kind:"area",index:n.index,x:m-r.textWidth(n.text,n.fontSize)/2,y:g,width:r.textWidth(n.text,n.fontSize),height:n.fontSize,text:n.text}}a.restore()}e.push({kind:"area",index:n.index,x:l,y:h,width:u,height:c,text:n.text}),d&&e.push(d)};for(n.s();!(i=n.n()).done;)a()}catch(e){n.e(e)}finally{n.f()}}},{key:"drawLines",value:function drawLines(e,t){var i,r=this,n=_createForOfIteratorHelper(this.resolved.lines);try{for(n.s();!(i=n.n()).done;){var a=i.value,o=this.ctx,s="y"===a.axis,l=this.snap(a.pixel);o.save(),o.beginPath(),o.strokeStyle=a.color,o.lineWidth=a.lineWidth*this.unit(),"function"==typeof o.setLineDash&&o.setLineDash(a.lineDash.map(function(e){return e*r.unit()})),s?(o.moveTo(t.x,l),o.lineTo(t.x+t.width,l)):(o.moveTo(l,t.y),o.lineTo(l,t.y+t.height)),o.stroke(),o.restore();var h=s?{kind:"line",index:a.index,x:t.x,y:a.pixel-1,width:t.width,height:2,text:a.text}:{kind:"line",index:a.index,x:a.pixel-1,y:t.y,width:2,height:t.height,text:a.text};e.push(h),a.text&&e.push(this.drawLineText(a,t,s))}}catch(e){n.e(e)}finally{n.f()}}},{key:"drawLineText",value:function drawLineText(e,t,i){var r=this.ctx;r.save(),this.setFont(e.fontSize,this.theme.fontFamily,"normal"),r.fillStyle=e.textColor;var n,a=this.textWidth(e.text,e.fontSize);if(i){var o="start"===e.textPosition?"left":"end"===e.textPosition?"right":"center",s="start"===e.textPosition?t.x+6:"end"===e.textPosition?t.x+t.width-6:t.x+t.width/2,l=e.pixel-e.fontSize-4<t.y,h=l?e.pixel+4:e.pixel-4;r.textAlign=o,r.textBaseline=l?"top":"bottom",this.strokeHalo(function(){return r.strokeText(e.text,s,h)}),r.fillText(e.text,s,h);var u="right"===o?s-a:"center"===o?s-a/2:s;n={kind:"line",index:e.index,x:u,y:l?h:h-e.fontSize,width:a,height:e.fontSize,text:e.text}}else{var c=e.pixel+4+a>t.x+t.width,d=c?e.pixel-4:e.pixel+4,f=t.y+6;r.textAlign=c?"right":"left",r.textBaseline="top",this.strokeHalo(function(){return r.strokeText(e.text,d,f)}),r.fillText(e.text,d,f),n={kind:"line",index:e.index,x:c?d-a:d,y:f,width:a,height:e.fontSize,text:e.text}}return r.restore(),n}},{key:"drawPoints",value:function drawPoints(e){var t,i=_createForOfIteratorHelper(this.resolved.points);try{for(i.s();!(t=i.n()).done;){var r=t.value,n=this.ctx,a=r.symbolSize/2;n.save(),n.beginPath(),n.fillStyle=r.color,"circle"===r.symbol?n.arc(r.x,r.y,a,0,2*Math.PI):"rect"===r.symbol?n.rect(r.x-a,r.y-a,r.symbolSize,r.symbolSize):"diamond"===r.symbol?(n.moveTo(r.x,r.y-a),n.lineTo(r.x+a,r.y),n.lineTo(r.x,r.y+a),n.lineTo(r.x-a,r.y),n.closePath()):(n.moveTo(r.x,r.y-a),n.lineTo(r.x+a,r.y+a),n.lineTo(r.x-a,r.y+a),n.closePath()),n.fill(),n.restore(),e.push({kind:"point",index:r.index,x:r.x-a,y:r.y-a,width:r.symbolSize,height:r.symbolSize,text:r.text}),r.text&&e.push(this.drawPointText(r))}}catch(e){i.e(e)}finally{i.f()}}},{key:"drawPointText",value:function drawPointText(e){var t=this.ctx,i=e.symbolSize/2;t.save(),this.setFont(e.fontSize,this.theme.fontFamily,"normal"),t.fillStyle=e.textColor;var r=this.textWidth(e.text,e.fontSize),n=e.x,a=e.y,o="center",s="bottom";"top"===e.textPosition?(o="center",s="bottom",a=e.y-i-3):"bottom"===e.textPosition?(o="center",s="top",a=e.y+i+3):"left"===e.textPosition?(o="right",s="middle",n=e.x-i-3):(o="left",s="middle",n=e.x+i+3),t.textAlign=o,t.textBaseline=s,this.strokeHalo(function(){return t.strokeText(e.text,n,a)}),t.fillText(e.text,n,a),t.restore();var l="right"===o?n-r:"center"===o?n-r/2:n,h=e.fontSize,u="bottom"===s?a-h:"middle"===s?a-h/2:a;return{kind:"point",index:e.index,x:l,y:u,width:r,height:h,text:e.text}}},{key:"strokeHalo",value:function strokeHalo(e){var t=this.ctx,i=this.theme?this.theme.labelHaloColor:null;if(i){var r=t.lineWidth,n=t.lineJoin,a=t.strokeStyle;t.lineWidth=3*this.unit(),t.lineJoin="round",t.strokeStyle=i,e(),t.lineWidth=r,t.lineJoin=n,t.strokeStyle=a}}},{key:"textWidth",value:function textWidth(e,t){return measureTextWidth(this.ctx,e,t,this.theme?this.theme.fontFamily:"sans-serif")}}])}(),E=function(){function PlotArea(e){var t;return _classCallCheck(this,PlotArea),_defineProperty(t=_callSuper(this,PlotArea,[_objectSpread2({interactive:!0},e)]),"background",null),_defineProperty(t,"borderColor",null),t}return _inherits(PlotArea,I),_createClass(PlotArea,[{key:"setBackground",value:function setBackground(e){return this.background=e,this.markDirty()}},{key:"doRender",value:function doRender(){this.ctx.beginPath();var e=this.state,t=e.width,i=e.height;if(this.background&&(this.ctx.fillStyle=this.background,this.ctx.fillRect(0,0,t,i)),this.borderColor){this.ctx.strokeStyle=this.borderColor,this.ctx.lineWidth=this.unit();var r=this.unit()/2;this.ctx.strokeRect(r,r,t-this.unit(),i-this.unit())}}}])}(),L=function(){function Legend(e){var t;return _classCallCheck(this,Legend),_defineProperty(t=_callSuper(this,Legend,[_objectSpread2({interactive:!0},e)]),"layout",null),_defineProperty(t,"theme",null),_defineProperty(t,"selectable",!0),_defineProperty(t,"hoverIndex",-1),t}return _inherits(Legend,I),_createClass(Legend,[{key:"items",get:function get(){return this.layout&&this.layout.legend?this.layout.legend.items:[]}},{key:"hitItem",value:function hitItem(e,t){for(var i=this.items,r=0;r<i.length;r++){var n=i[r];if(e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)return r}return-1}},{key:"containsLocalPoint",value:function containsLocalPoint(e,t){return this.selectable&&this.hitItem(e,t)>=0}},{key:"doRender",value:function doRender(){if(this.theme&&this.layout&&this.layout.legend){var e=this.ctx,t=this.layout.legend.items;this.layout.legend,e.beginPath(),e.save();for(var i=0;i<t.length;i++){var r=t[i],n=r.y+r.height/2;e.globalAlpha=r.hidden?.45:1,e.fillStyle=r.color,roundRect(e,r.x,n-6,12,12,Math.min(3,6)),e.fill(),this.setFont(this.theme.fontSize,this.theme.fontFamily),e.textAlign="left",e.textBaseline="middle",e.fillStyle=r.hidden?this.theme.legend.inactiveColor:this.theme.legend.textColor,e.fillText(r.name,r.x+12+6,n),this.hoverIndex===i&&(e.globalAlpha=1,e.strokeStyle=this.theme.axisLineColor,e.lineWidth=this.unit(),roundRect(e,r.x-4,r.y+1,r.width+8,r.height-2,4),e.stroke())}e.restore()}}}])}();function roundRect(e,t,i,r,n,a){var o=Math.max(0,Math.min(a,r/2,n/2));e.beginPath(),o<=0?e.rect(t,i,r,n):(e.moveTo(t+o,i),e.lineTo(t+r-o,i),e.arcTo(t+r,i,t+r,i+o,o),e.lineTo(t+r,i+n-o),e.arcTo(t+r,i+n,t+r-o,i+n,o),e.lineTo(t+o,i+n),e.arcTo(t,i+n,t,i+n-o,o),e.lineTo(t,i+o),e.arcTo(t,i,t+o,i,o),e.closePath())}var z=function(){function Title(e){var t;return _classCallCheck(this,Title),_defineProperty(t=_callSuper(this,Title,[_objectSpread2({interactive:!1},e)]),"layout",null),_defineProperty(t,"theme",null),t}return _inherits(Title,I),_createClass(Title,[{key:"doRender",value:function doRender(){var e=this.layout&&this.layout.title;if(e&&this.theme&&this.layout){var t=this.layout.canvas,i=this.ctx,r="left"===e.align?0:"right"===e.align?t.width:t.width/2,n=e.y;i.save(),i.textAlign=e.align,i.textBaseline="top",e.text&&(this.setFont(e.textStyle.fontSize,this.theme.fontFamily,e.textStyle.fontWeight),i.fillStyle=e.textStyle.color,i.fillText(e.text,r,n),n+=1.5*e.textStyle.fontSize),e.subtext&&(this.setFont(e.subtextStyle.fontSize,this.theme.fontFamily),i.fillStyle=e.subtextStyle.color,i.fillText(e.subtext,r,n)),i.restore()}}}])}(),B=function(){function Tooltip(e){var t;return _classCallCheck(this,Tooltip),_defineProperty(t=_callSuper(this,Tooltip,[_objectSpread2({interactive:!1},e)]),"theme",null),_defineProperty(t,"option",{}),_defineProperty(t,"layout",null),_defineProperty(t,"content",null),_defineProperty(t,"anchor",[0,0]),_defineProperty(t,"follow",!0),_defineProperty(t,"lastRect",null),_defineProperty(t,"pendingClear",!1),t}return _inherits(Tooltip,I),_createClass(Tooltip,[{key:"show",value:function show(e,t){var i=!this.content||this.pendingClear||this.currentOpacity()<.999;return this.content=e,this.anchor=t,this.pendingClear=!1,i&&this.playFade(!0),this.markDirty()}},{key:"hide",value:function hide(){return this.content?shouldAnimate()?(this.pendingClear=!0,this.playFade(!1),this.markDirty()):(this.content=null,this.lastRect=null,this.markDirty()):this}},{key:"panelOpacity",value:function panelOpacity(){var e=Number(this.state.panelOpacity);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"currentOpacity",value:function currentOpacity(){var e=Number(this.state.panelOpacity);return isFinite(e)?Math.max(0,Math.min(1,e)):0}},{key:"playFade",value:function playFade(e){if(!shouldAnimate())return this.setState({panelOpacity:e?1:0,slideY:0}),void(e||(this.content=null,this.lastRect=null));var t=_objectSpread2({},this.props.animations||{});t.panelOpacity={from:this.currentOpacity(),to:e?1:0,duration:e?140:110,easing:e?"easeOutCubic":"easeInQuad",startTime:void 0,finished:!1},e&&(t.slideY={from:6,to:0,duration:180,easing:"easeOutCubic",startTime:void 0,finished:!1},this.state.slideY=6),this.props.animations=t,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),this.markDirty()}},{key:"doRender",value:function doRender(){if(this.lastRect=null,this.content&&this.theme&&this.layout){var e=this.panelOpacity();if(this.pendingClear&&e<=.02)return this.content=null,void(this.pendingClear=!1);var t,i=this.theme,r=this.option,n=i.tooltip,a=r.fontSize||n.fontSize,o=i.fontFamily,s=n.padding,l=1.6*a,h=this.content.rows,u=this.content.title?measureTextWidth(this.ctx,this.content.title,a,o):0,c=0,d=_createForOfIteratorHelper(h);try{for(d.s();!(t=d.n()).done;){var f=t.value,p=16+measureTextWidth(this.ctx,f.name,a,o)+16+measureTextWidth(this.ctx,f.value,a,o);p>c&&(c=p)}}catch(e){d.e(e)}finally{d.f()}var v=Math.max(u,c)+2*s,m=2*s+(this.content.title?l:0)+h.length*l,g=r.offset||[14,14],b=this.layout.canvas,k=this.layout.plot,S=this.anchor[0]+g[0],w=this.anchor[1]+g[1];S+v>b.width&&(S=this.anchor[0]-g[0]-v),S=v<=k.width-4?Math.max(k.x+2,Math.min(S,k.x+k.width-v-2)):Math.max(2,Math.min(S,Math.max(2,b.width-v-2))),w+m>b.height&&(w=this.anchor[1]-g[1]-m);var A=k.y+k.height-(a+8)/2;if(w+m>A){var _=this.anchor[1]-g[1]-m;w=_>=k.y+2?_:Math.max(k.y+2,A-m)}w=Math.max(2,Math.min(w,Math.max(2,b.height-m-2))),this.lastRect={x:S,y:w,width:v,height:m};var M=this.ctx,C=this.unit();M.beginPath(),M.save(),M.globalAlpha=e,w+=Number(this.state.slideY)||0,M.shadowColor=n.shadowColor,M.shadowBlur=10*C,M.shadowOffsetY=2*C,M.fillStyle=r.backgroundColor||n.background,roundRect(M,S,w,v,m,n.radius),M.fill(),M.shadowColor="transparent",M.shadowBlur=0,M.shadowOffsetY=0,M.strokeStyle=r.borderColor||n.borderColor,M.lineWidth=C,roundRect(M,S+C/2,w+C/2,v-C,m-C,n.radius),M.stroke(),M.fillStyle=r.textColor||n.textColor,M.textAlign="left",M.textBaseline="middle";var T=w+s+l/2;this.content.title&&(this.setFont(a,o,"bold"),M.fillText(this.content.title,S+s,T),T+=l);var P,I=_createForOfIteratorHelper(h);try{for(I.s();!(P=I.n()).done;){var O=P.value,N=T+l/2-l/2+l/2;this.setFont(a,o),M.fillStyle=O.color,roundRect(M,S+s,N-4,8,8,2),M.fill(),M.fillStyle=r.textColor||n.textColor,M.fillText(O.name,S+s+8+8,N),M.textAlign="right",M.fillText(O.value,S+v-s,N),M.textAlign="left",T+=l}}catch(e){I.e(e)}finally{I.f()}M.restore()}}}])}();var W=function(){function Crosshair(e){var t;return _classCallCheck(this,Crosshair),_defineProperty(t=_callSuper(this,Crosshair,[_objectSpread2({interactive:!1},e)]),"layout",null),_defineProperty(t,"theme",null),_defineProperty(t,"option",{}),_defineProperty(t,"pixelX",null),_defineProperty(t,"pixelY",null),_defineProperty(t,"xLabel",""),_defineProperty(t,"yLabel",""),_defineProperty(t,"lastChipRects",[]),_defineProperty(t,"followDuration",90),t}return _inherits(Crosshair,I),_createClass(Crosshair,[{key:"show",value:function show(e,t,i,r){var n=null!==this.pixelX&&null!==e&&Math.abs(this.pixelX-e)<.5&&(this.pixelY===t||null!==this.pixelY&&null!==t&&Math.abs(this.pixelY-t)<.5);return this.pixelX=e,this.pixelY=t,this.xLabel=i,this.yLabel=r,n||this.animateAxis(e,t),this.markDirty()}},{key:"drawnX",value:function drawnX(){var e=Number(this.state.axisX);return null===this.pixelX?null:isFinite(e)?e:this.pixelX}},{key:"drawnY",value:function drawnY(){var e=Number(this.state.axisY);return null===this.pixelY?null:isFinite(e)?e:this.pixelY}},{key:"animateAxis",value:function animateAxis(e,t){if(!shouldAnimate()||null===e||this.followDuration<=0)this.setState({axisX:e,axisY:t});else{var i=this.drawnX(),r=this.drawnY();if(null!==i){var n=function crosshairGlideDuration(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;if(!isFinite(t)||t<=0)return 0;var r=Math.abs(e);return!isFinite(r)||r<=0?0:Math.max(16,Math.min(t,r/i))}(Math.abs(e-i),this.followDuration);if(n<=0)this.setState({axisX:e,axisY:t});else{var a=_objectSpread2({},this.props.animations||{});a.axisX={from:i,to:e,duration:n,easing:"easeOutCubic",startTime:void 0,finished:!1},null!==r&&null!==t&&(a.axisY={from:r,to:t,duration:n,easing:"easeOutCubic",startTime:void 0,finished:!1}),this.props.animations=a,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this)}}else this.setState({axisX:e,axisY:t})}}},{key:"hide",value:function hide(){return null===this.pixelX&&null===this.pixelY?this:(this.pixelX=null,this.pixelY=null,this.stopAxisAnimation(),this.markDirty())}},{key:"stopAxisAnimation",value:function stopAxisAnimation(){var e=this.props.animations;if(e)for(var t in e)e[t]&&(e[t].finished=!0);this.ice&&this.ice.animationManager&&this.ice.animationManager.remove(this),this.state.axisX=null,this.state.axisY=null}},{key:"doRender",value:function doRender(){if(this.lastChipRects=[],this.layout&&this.theme&&!1!==this.option.show&&"none"!==this.option.type&&(null!==this.pixelX||null!==this.pixelY)){var e=this.layout.plot,t=this.ctx,i=this.unit(),r=this.option.axis||"x";if(t.beginPath(),t.save(),t.strokeStyle=this.option.lineColor||this.theme.crosshair.lineColor,t.lineWidth=i,"function"==typeof t.setLineDash&&t.setLineDash([3*i,3*i]),t.beginPath(),null!==this.pixelX&&"y"!==r){var n=this.snap(this.drawnX());t.moveTo(n,e.y),t.lineTo(n,e.y+e.height)}if(null!==this.pixelY&&("y"===r||"xy"===r)){var a=this.snap(this.drawnY());t.moveTo(e.x,a),t.lineTo(e.x+e.width,a)}t.stroke(),"function"==typeof t.setLineDash&&t.setLineDash([]),!1!==this.option.showAxisLabel&&(this.setFont(this.theme.fontSize,this.theme.fontFamily),t.textAlign="center",t.textBaseline="middle",null!==this.pixelX&&this.xLabel&&"y"!==r&&this.drawChip(this.snap(this.drawnX()),e.y+e.height,this.xLabel),null===this.pixelY||!this.yLabel||"y"!==r&&"xy"!==r||this.drawChip(e.x,this.snap(this.drawnY()),this.yLabel)),t.restore()}}},{key:"drawChip",value:function drawChip(e,t,i){var r=this.ctx,n=this.theme,a=r.measureText(i).width+12,o=n.fontSize+6;r.fillStyle=n.crosshair.labelBackground,this.lastChipRects.push({x:e-a/2,y:t-o/2,width:a,height:o}),r.fillRect(e-a/2,t-o/2,a,o),r.fillStyle=n.crosshair.labelColor,r.fillText(i,e,t)}}])}(),V=function(){function Highlight(e){var t;return _classCallCheck(this,Highlight),_defineProperty(t=_callSuper(this,Highlight,[_objectSpread2({interactive:!1},e)]),"theme",null),_defineProperty(t,"hoverItems",[]),_defineProperty(t,"selectionItems",[]),t}return _inherits(Highlight,I),_createClass(Highlight,[{key:"setHover",value:function setHover(e){return this.hoverItems=e,this.markDirty()}},{key:"setSelection",value:function setSelection(e){return this.selectionItems=e,this.markDirty()}},{key:"doRender",value:function doRender(){if(this.theme){var e=this.ctx,t=this.unit();e.beginPath(),e.save();var i,r=_createForOfIteratorHelper(this.hoverItems);try{for(r.s();!(i=r.n()).done;){var n=i.value;if("rect"===n.shape){var a=n.width||0,o=n.height||0;if(a<=0||o<=0)continue;e.strokeStyle=n.color,e.lineWidth=Math.max(t,1.5*t),roundRect(e,n.x-a/2,n.y-o/2,a,o,Math.min(4,a/2,o/2)),e.stroke()}else{var s=Math.max(3,n.size/2+3);e.beginPath(),e.arc(n.x,n.y,s,0,2*Math.PI),e.fillStyle="rgba(255,255,255,0.55)",e.fill(),e.beginPath(),e.arc(n.x,n.y,s,0,2*Math.PI),e.strokeStyle=n.color,e.lineWidth=Math.max(t,1.5*t),e.stroke()}}}catch(e){r.e(e)}finally{r.f()}var l,h=_createForOfIteratorHelper(this.selectionItems);try{for(h.s();!(l=h.n()).done;){var u=l.value;if(e.strokeStyle=this.theme.selection.stroke,e.lineWidth=Math.max(t,1.5*t),"rect"===u.shape){var c=u.width||0,d=u.height||0;if(c<=0||d<=0)continue;roundRect(e,u.x-c/2-2,u.y-d/2-2,c+4,d+4,5),e.stroke()}else{var f=Math.max(3,u.size/2+3);e.beginPath(),e.arc(u.x,u.y,f,0,2*Math.PI),e.stroke()}}}catch(e){h.e(e)}finally{h.f()}e.restore()}}}])}(),j=function(){function Brush(e){var t;return _classCallCheck(this,Brush),_defineProperty(t=_callSuper(this,Brush,[_objectSpread2({interactive:!1},e)]),"theme",null),_defineProperty(t,"rect",null),_defineProperty(t,"color",null),t}return _inherits(Brush,I),_createClass(Brush,[{key:"setRect",value:function setRect(e){return this.rect=e,e?this.keepAnimating():this.stopAnimating(),this.markDirty()}},{key:"doRender",value:function doRender(){if(this.rect&&this.theme){var e=this.ctx,t=this.color||this.theme.brush,i=this.unit();if(e.beginPath(),e.save(),e.fillStyle=t.fill,e.fillRect(this.rect.x,this.rect.y,this.rect.width,this.rect.height),e.strokeStyle=t.stroke,e.lineWidth=i,"function"==typeof e.setLineDash){var r=[5*i,4*i],n=r[0]+r[1]||1;e.setLineDash(r),"number"==typeof e.lineDashOffset&&(e.lineDashOffset=-Date.now()/1e3*26%n)}e.strokeRect(this.rect.x,this.rect.y,this.rect.width,this.rect.height),"function"==typeof e.setLineDash&&e.setLineDash([]),e.restore()}}}])}(),U=function(){function RadarGrid(e){var t;return _classCallCheck(this,RadarGrid),_defineProperty(t=_callSuper(this,RadarGrid,[_objectSpread2({interactive:!1},e)]),"coord",null),_defineProperty(t,"theme",null),_defineProperty(t,"layout",null),t}return _inherits(RadarGrid,I),_createClass(RadarGrid,[{key:"doRender",value:function doRender(){var e=this.coord,t=this.theme;if(e&&t){var i=this.ctx,r=this.unit(),n=e.indicators.length;if(n){var a=e.polar.cx,o=e.polar.cy,s=e.polar.radius,l=function angleOf(e){return-Math.PI/2+e/n*Math.PI*2};this.layout,i.beginPath(),i.save(),i.lineWidth=r,i.strokeStyle=t.splitLineColor;for(var h=1;h<=e.splitNumber;h++){var u=s*h/e.splitNumber;if(i.beginPath(),"circle"===e.shape)i.arc(a,o,u,0,2*Math.PI);else{for(var c=0;c<n;c++){var d=l(c),f=a+Math.cos(d)*u,p=o+Math.sin(d)*u;0===c?i.moveTo(f,p):i.lineTo(f,p)}i.closePath()}i.stroke()}i.beginPath();for(var v=0;v<n;v++){var m=l(v);i.moveTo(a,o),i.lineTo(a+Math.cos(m)*s,o+Math.sin(m)*s)}i.stroke(),this.setFont(t.fontSize,t.fontFamily),i.fillStyle=t.subTextColor,i.textBaseline="middle";for(var g=0;g<n;g++){var b=l(g),k=a+Math.cos(b)*(s+10*r),S=o+Math.sin(b)*(s+10*r),w=Math.cos(b);i.textAlign=Math.abs(w)<.2?"center":w>0?"left":"right",i.fillText(e.indicators[g].name,k,S)}i.restore()}}}}])}(),X=function(){function PolarGrid(e){var t;return _classCallCheck(this,PolarGrid),_defineProperty(t=_callSuper(this,PolarGrid,[_objectSpread2({interactive:!1},e)]),"coord",null),_defineProperty(t,"theme",null),_defineProperty(t,"layout",null),t}return _inherits(PolarGrid,I),_createClass(PolarGrid,[{key:"geometry",value:function geometry(){var e=this.coord;if(!e)return null;var t=e.plot,i=t.x+e.xScale.map(0),r=t.y+e.yScale.map(0);if(!isFinite(i)||!isFinite(r))return null;var n=Math.min(Math.abs(i-t.x),Math.abs(t.x+t.width-i),Math.abs(r-t.y),Math.abs(t.y+t.height-r));if(!(n>1))return null;var a=e.xScale.map(1)-e.xScale.map(0);return{cx:i,cy:r,radiusPx:n,rMax:Math.abs(a)>1e-9?n/Math.abs(a):0}}},{key:"doRender",value:function doRender(){var e=this.coord,t=this.theme;if(e&&t&&!1!==e.options.show){var i=this.geometry();if(i){var r=i.cx,n=i.cy,a=i.radiusPx,o=i.rMax,s=e.options,l=Math.max(1,Math.min(12,Number(s.splitNumber)||4)),h=Math.max(4,Math.min(36,Number(s.spokeCount)||12)),u=(Number(s.startAngle)||0)*Math.PI/180,c=this.unit(),d=this.ctx;d.beginPath(),d.save(),d.lineWidth=c,d.strokeStyle=t.splitLineColor;for(var f=1;f<=l;f++)d.beginPath(),d.arc(r,n,a*f/l,0,2*Math.PI),d.stroke();d.beginPath();for(var p=0;p<h;p++){var v=u+p/h*Math.PI*2;d.moveTo(r,n),d.lineTo(r+Math.cos(v)*a,n+Math.sin(v)*a)}if(d.stroke(),!1!==s.showLabels&&o>0){var m=u+Math.PI/4,g=Math.cos(m),b=Math.sin(m);this.setFont(t.fontSize,t.fontFamily),d.fillStyle=t.subTextColor,d.textBaseline="middle";for(var k=1;k<=l;k++){var S=o*k/l,w=r+g*(a*k/l),A=n+b*(a*k/l);d.textAlign=g>=0?"left":"right";var _=Math.abs(S)>=1?String(Number(S.toPrecision(3))):String(Number(S.toPrecision(2)));d.strokeStyle="transparent"===t.backgroundColor?"#ffffff":t.backgroundColor,d.lineWidth=3*c,d.strokeText(_,w+3*g*c,A+3*b*c),d.fillText(_,w+3*g*c,A+3*b*c),d.strokeStyle=t.splitLineColor,d.lineWidth=c}}d.restore()}}}}])}(),K=function(){function DataZoomSlider(e){var t;return _classCallCheck(this,DataZoomSlider),_defineProperty(t=_callSuper(this,DataZoomSlider,[_objectSpread2({interactive:!0},e)]),"theme",null),_defineProperty(t,"start",0),_defineProperty(t,"end",1),_defineProperty(t,"activePart",null),_defineProperty(t,"handleWidth",12),t}return _inherits(DataZoomSlider,I),_createClass(DataZoomSlider,[{key:"setWindow",value:function setWindow(e,t){var i=clamp$2(e,0,1),r=clamp$2(t,0,1);return Math.abs(i-this.start)<1e-6&&Math.abs(r-this.end)<1e-6?this:(this.start=i,this.end=r,this.markDirty())}},{key:"setActive",value:function setActive(e){return this.activePart===e?this:(this.activePart=e,this.markDirty())}},{key:"hitPart",value:function hitPart(e,t){var i=this.state,r=i.width,n=i.height;if(e<0||e>r||t<0||t>n)return null;var a=this.start*r,o=this.end*r,s=this.handleWidth/2;return Math.abs(e-a)<=s?"start":Math.abs(e-o)<=s?"end":e>a&&e<o?"window":"track"}},{key:"fractionAt",value:function fractionAt(e){return clamp$2(e/(this.state.width||1),0,1)}},{key:"doRender",value:function doRender(){if(this.theme){var e=this.ctx,t=this.state,i=t.width,r=t.height,n=this.unit(),a=Math.max(4,Math.round(.34*r)),o=(r-a)/2,s=this.start*i,l=this.end*i,h=this.theme.colorPalette[0],u=this.handleWidth;e.beginPath(),e.save(),e.fillStyle=this.theme.splitLineColor,roundRect(e,0,o,i,a,a/2),e.fill(),e.fillStyle=h,e.globalAlpha=.85,roundRect(e,s,o,Math.max(2,l-s),a,a/2),e.fill(),e.globalAlpha=1;for(var c=0,d=[[s,"start"],[l,"end"]];c<d.length;c++){var f=_slicedToArray(d[c],2),p=f[0],v=f[1],m=clamp$2(p-u/2,0,Math.max(0,i-u));e.fillStyle="#ffffff",e.strokeStyle=this.activePart===v?h:this.theme.axisLineColor,e.lineWidth=(this.activePart===v?2:1)*n,roundRect(e,m,1,u,r-2,3),e.fill(),e.stroke(),e.beginPath(),e.moveTo(m+u/2-2,o-3),e.lineTo(m+u/2-2,o+a+3),e.moveTo(m+u/2+2,o-3),e.lineTo(m+u/2+2,o+a+3),e.strokeStyle=this.theme.subTextColor,e.lineWidth=n,e.stroke()}e.restore()}}}])}(),G=function(){function SeriesBase(e,t){var i;return _classCallCheck(this,SeriesBase),_defineProperty(i=_callSuper(this,SeriesBase,[_objectSpread2({interactive:!0},t)]),"chartTheme",null),_defineProperty(i,"hiddenSlices",[]),_defineProperty(i,"coord",null),_defineProperty(i,"barSlot",{index:0,count:1}),_defineProperty(i,"pixels",new Float64Array(0)),_defineProperty(i,"effective",new Float64Array(0)),_defineProperty(i,"fromEffective",null),_defineProperty(i,"renderIndices",null),_defineProperty(i,"xMonotonic",!0),_defineProperty(i,"sizeExtent",[0,1]),_defineProperty(i,"itemProgress",new Float64Array(0)),_defineProperty(i,"stagger",0),_defineProperty(i,"animationKind","enter"),_defineProperty(i,"hoverIndex",null),_defineProperty(i,"cacheKey",""),_defineProperty(i,"supportsSampling",!0),_defineProperty(i,"clipToBox",!1),_defineProperty(i,"localBoxScratch",[0,0,0,0]),i.series=e,i}return _inherits(SeriesBase,I),_createClass(SeriesBase,[{key:"__localBox",value:function __localBox(){var e=this.paintPad(),t=this.localBoxScratch;return t[0]=-e,t[1]=-e,t[2]=(this.state.width||0)+e,t[3]=(this.state.height||0)+e,t}},{key:"paintPad",value:function paintPad(){var e=this.series.option,t=!1===e.showSymbol?0:this.maxSymbolSize()/2+4;return Math.max(t,(e.lineWidth||2)+4,6)}},{key:"symbolSizeAt",value:function symbolSizeAt(e){var t=this.series.option,i=this.series.points[e],r=t.symbolSize;if("function"==typeof r){var n=i?i.y:null,a=NaN;try{a=Number(r(n,{dataIndex:e,data:i?i.raw:void 0,seriesName:this.series.name}))}catch(e){a=NaN}return isFinite(a)&&a>0?a:8}if(i&&"number"==typeof i.size&&isFinite(i.size)){var o=Array.isArray(t.symbolSizeRange)?t.symbolSizeRange:[8,40],s=_slicedToArray(this.sizeExtent,2),l=s[0],h=s[1],u=h>l?(i.size-l)/(h-l):.5;return o[0]+(o[1]-o[0])*Math.max(0,Math.min(1,u))}var c=Number(r);return isFinite(c)&&c>0?c:8}},{key:"maxSymbolSize",value:function maxSymbolSize(){var e=this.series.option;if("function"==typeof e.symbolSize||this.series.points.some(function(e){return"number"==typeof e.size})){var t=Array.isArray(e.symbolSizeRange)?e.symbolSizeRange:[8,40];return Math.max(8,Number(t[1])||40)}var i=Number(e.symbolSize);return isFinite(i)&&i>0?i:8}},{key:"setCoord",value:function setCoord(e){return this.coord=e,this.cacheKey="",this.markDirty()}},{key:"setHiddenSlices",value:function setHiddenSlices(e){return this.hiddenSlices=e||[],this.markDirty()}},{key:"setAnimationStage",value:function setAnimationStage(e){return this.stagger=e&&isFinite(Number(e.stagger))?Math.max(0,Math.min(.95,Number(e.stagger))):0,this.animationKind=e&&"update"===e.kind?"update":"enter",this}},{key:"isEntering",value:function isEntering(){return"enter"===this.animationKind&&this.progress()<1}},{key:"progressFor",value:function progressFor(e,t){var i=this.progress();if(i>=1)return 1;if(this.stagger<=0||t<=1)return i;var r=1/(1+this.stagger),n=(i-e/(t-1)*this.stagger*r)/r;return n<=0?0:n>=1?1:n}},{key:"computeItemProgress",value:function computeItemProgress(){var e=this.series.points.length;this.itemProgress.length!==e&&(this.itemProgress=new Float64Array(e));for(var t=0;t<e;t++)this.itemProgress[t]=this.progressFor(t,e)}},{key:"getAnimationState",value:function getAnimationState(){return this.computeItemProgress(),{progress:this.progress(),kind:this.animationKind,stagger:this.stagger,itemProgress:Array.from(this.itemProgress)}}},{key:"setHoverIndex",value:function setHoverIndex(e){var t=void 0===e?null:e;if(this.hoverIndex!==t){var i=null!==this.hoverIndex;this.hoverIndex=t;var r=this.highlightT(),n=null===t?0:1;if(!shouldAnimate())return this.setState({highlightT:n}),void this.markDirty();var a=_objectSpread2({},this.props.animations||{});a.highlightT={from:r,to:n,duration:null===t?180:260,easing:null===t?"easeOutCubic":"springSnappy",startTime:void 0,finished:!1},this.props.animations=a,this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this),i||null===t||this.markDirty()}}},{key:"highlightT",value:function highlightT(){var e=Number(this.state.highlightT);return isFinite(e)?Math.max(0,Math.min(1.2,e)):0}},{key:"hoverBoost",value:function hoverBoost(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.12,i=arguments.length>2?arguments[2]:void 0;return this.hoverIndex!==e?1:1+t*(void 0===i?this.highlightT():Math.max(0,Math.min(1,i)))}},{key:"hoverAlpha",value:function hoverAlpha(e){return this.hoverIndex!==e?0:Math.max(0,Math.min(1,this.highlightT()))}},{key:"drawHoverOverlay",value:function drawHoverOverlay(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.hoverAlpha(e);if(!(r<=.01||t.width<=0||t.height<=0)){var n=this.ctx,a=this.unit(),o=Number(i.radius)||0;n.save(),n.globalAlpha=r,"none"!==i.fill&&(roundRect(n,t.x,t.y,t.width,t.height,o),n.fillStyle=i.fill||"rgba(255,255,255,0.16)",n.fill()),roundRect(n,t.x,t.y,t.width,t.height,o),n.strokeStyle=i.stroke||"rgba(255,255,255,0.95)",n.lineWidth=Math.max(a,(i.lineWidth||2)*a),n.stroke(),n.restore()}}},{key:"buildSeriesKey",value:function buildSeriesKey(e){return[].concat(_toConsumableArray(e),[this.coordKey(),this.progress(),this.animationKind,this.stagger]).join("|")}},{key:"coordKey",value:function coordKey(){var e=this.coord;if(!e)return"-";var t=[];e.plot&&t.push("p".concat(e.plot.x,",").concat(e.plot.y,",").concat(e.plot.width,",").concat(e.plot.height));for(var i=0,r=["xScale","yScale"];i<r.length;i++){var n=r[i],a=e[n],o=a&&a.domain;o&&o.length&&t.push("".concat(n,"[").concat(o.length,"]:").concat(String(o[0]),"~").concat(String(o[o.length-1])))}return t.join(";")}},{key:"updateSeries",value:function updateSeries(e,t){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]||(this.fromEffective=t&&this.effective.length===2*e.points.length?new Float64Array(this.effective):null),this.series=e,this.cacheKey="",this.markDirty()}},{key:"pixelAt",value:function pixelAt(e){this.rebuildPixels();var t=this.pixels[2*e],i=this.pixels[2*e+1];return isFinite(t)&&isFinite(i)?[t,i]:null}},{key:"barRectAt",value:function barRectAt(e){return null}},{key:"containsLocalPoint",value:function containsLocalPoint(e,t){return this.hitTestIndex(e,t)>=0}},{key:"progress",value:function progress(){var e=Number(this.state.progress);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"computeEffective",value:function computeEffective(){var e=this.series.points,t=e.length;this.effective.length!==2*t&&(this.effective=new Float64Array(2*t),this.fromEffective=null),this.computeItemProgress();for(var i=this.progress(),r=0;r<t;r++){var n=this.itemProgress[r],a=e[r],o=a.top;if(null!=o){var s=isFinite(a.base)?a.base:0,l=0,h=0;if(this.fromEffective){var u=this.fromEffective[2*r],c=this.fromEffective[2*r+1];isFinite(u)&&(l=u),isFinite(c)&&(h=c)}this.effective[2*r]=n>=1?s:l+(s-l)*n,this.effective[2*r+1]=n>=1?o:h+(o-h)*n}else this.effective[2*r]=NaN,this.effective[2*r+1]=NaN}i>=1&&(this.fromEffective=null)}},{key:"rebuildPixels",value:function rebuildPixels(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.coord;if(t){var i=this.buildCacheKey(t);if(e||i!==this.cacheKey){this.computeEffective();var r=this.series.points,n=r.length;this.pixels.length!==2*n&&(this.pixels=new Float64Array(2*n));for(var a=t.xScale,o=t.yScale,s=!0,l=-1/0,h=0;h<n;h++){var u=r[h],c=a.map(u.xValue),d=this.effective[2*h+1],f=isFinite(d)?o.map(d):NaN;this.pixels[2*h]=c,this.pixels[2*h+1]=f,isFinite(c)&&(c<l&&(s=!1),l=c)}this.xMonotonic=s,this.sizeExtent=function computeSizeExtent(e){var t,i=1/0,r=-1/0,n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){var a=t.value;"number"==typeof a.size&&isFinite(a.size)&&(a.size<i&&(i=a.size),a.size>r&&(r=a.size))}}catch(e){n.e(e)}finally{n.f()}return isFinite(i)?i===r?[i,i+1]:[i,r]:[0,1]}(r),this.renderIndices=this.buildRenderIndices(n,t.plot.width),this.cacheKey=i}}else this.pixels=new Float64Array(0)}},{key:"buildRenderIndices",value:function buildRenderIndices(e,t){if(!this.supportsSampling||!this.xMonotonic)return null;var i=this.series.option;if("none"===i.sampling)return null;if(!i.sampling&&e<=Math.max(2e3,3*t))return null;var r=Math.max(64,Math.min(e,Math.floor(2*t)));return e<=r+2?null:function lttbIndices(e,t,i){if(i>=t||i<=2){for(var r=[],n=0;n<t;n++)r.push(n);return r}for(var a=[0],o=(t-2)/(i-2),s=0,l=0;l<i-2;l++){var h=Math.floor((l+1)*o)+1,u=Math.floor((l+2)*o)+1;u>t&&(u=t);for(var c=0,d=0,f=0;h<u;h++){var p=e[2*h+1];isFinite(p)&&(c+=e[2*h],d+=p,f++)}f?(c/=f,d/=f):(c=e[2*(t-1)],d=e[2*(t-1)+1],isFinite(d)||(d=e[2*s+1],c=e[2*s]));for(var v=Math.floor(l*o)+1,m=Math.min(Math.floor((l+1)*o)+1,t-1),g=e[2*s],b=e[2*s+1],k=-1,S=v,w=v;w<m;w++){var A=e[2*w+1];if(isFinite(A)){var _=e[2*w],M=Math.abs((g-c)*(A-b)-(g-_)*(d-b));M>k&&(k=M,S=w)}}a.push(S),s=S}return a.push(t-1),a}(this.pixels,e,r)}},{key:"renderCount",value:function renderCount(){return this.renderIndices?this.renderIndices.length:this.pixels.length/2}},{key:"renderIndexAt",value:function renderIndexAt(e){return this.renderIndices?this.renderIndices[e]:e}},{key:"nearestIndexAtX",value:function nearestIndexAtX(e){var t=this;this.rebuildPixels();var i=this.pixels.length/2;if(!i)return-1;if(!this.xMonotonic){for(var r=-1,n=1/0,a=0;a<i;a++){var o=this.pixels[2*a];if(isFinite(o)){var s=Math.abs(o-e);s<n&&(n=s,r=a)}}return r}for(var l=0,h=i-1;l<h;){var u=l+h>>1,c=this.pixels[2*u];!isFinite(c)||c<e?l=u+1:h=u}var d,f=[l,l-1].filter(function(e){return e>=0&&e<i&&isFinite(t.pixels[2*e])}),p=-1,v=1/0,m=_createForOfIteratorHelper(f);try{for(m.s();!(d=m.n()).done;){var g=d.value,b=Math.abs(this.pixels[2*g]-e);b<v&&(v=b,p=g)}}catch(e){m.e(e)}finally{m.f()}return p}},{key:"buildCacheKey",value:function buildCacheKey(e){var t=e.xScale.domain,i=e.yScale.domain;return[this.series.points.length,this.progress(),e.plot.width,e.plot.height,String(t[0]),String(t[t.length-1]),String(i[0]),String(i[1]),this.series.points.length?String(this.series.points[0].xValue):""].join("|")}},{key:"eachSegment",value:function eachSegment(e){for(var t=this.pixels.length/2,i=0;i<t-1;i++){var r=this.pixels[2*i],n=this.pixels[2*i+1],a=this.pixels[2*(i+1)],o=this.pixels[2*(i+1)+1];isFinite(r)&&isFinite(n)&&isFinite(a)&&isFinite(o)&&e(r,n,a,o,i)}}},{key:"pointColor",value:function pointColor(e){return this.series.option.color||this.series.color}},{key:"lineWidthDevice",value:function lineWidthDevice(){var e=this.series.option.lineWidth;return isFinite(e)?e:2}},{key:"opacity",value:function opacity(){var e=Number(this.series.option.opacity);return isFinite(e)?Math.max(0,Math.min(1,e)):1}},{key:"beginDraw",value:function beginDraw(){this.ctx.beginPath(),this.ctx.save(),this.clipToBox&&(this.ctx.beginPath(),this.ctx.rect(0,0,this.state.width,this.state.height),this.ctx.clip()),this.ctx.lineJoin="round",this.ctx.lineCap="round",this.ctx.globalAlpha=this.opacity()}},{key:"endDraw",value:function endDraw(){this.ctx.restore()}},{key:"drawSymbol",value:function drawSymbol(e,t,i,r,n,a){var o=this.ctx,s=this.unit();o.beginPath(),"rect"===i?o.rect(e-r/2,t-r/2,r,r):o.arc(e,t,Math.max(1,r/2),0,2*Math.PI),n&&(o.fillStyle=n,o.fill()),a&&(o.strokeStyle=a,o.lineWidth=s,o.stroke())}},{key:"pointByIndex",value:function pointByIndex(e){return this.series.points[e]||null}}])}();var Y=function(){function LineSeries(){var e;_classCallCheck(this,LineSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,LineSeries,[].concat(i)),"seriesType","line"),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"fillArea",!1),e}return _inherits(LineSeries,G),_createClass(LineSeries,[{key:"doRender",value:function doRender(){this.rebuildPixels();var e=this.renderPoints();if(e.length){var t=this.series.option,i=this.pointColor(0),r=this.unit(),n=this.lineWidthDevice()*r,a=t.symbol||"circle",o=!0===t.showSymbol||"scatter"===this.seriesType,s=this.ctx;if(this.beginDraw(),this.fillArea&&this.drawArea(i,e),s.beginPath(),s.strokeStyle=i,s.lineWidth=n,"function"==typeof s.setLineDash&&Array.isArray(t.lineDash)&&s.setLineDash(t.lineDash.map(function(e){return e*r})),t.smooth?this.drawSmoothLine(e,"number"==typeof t.smooth?t.smooth:.5):this.drawStraightLine(e),s.stroke(),"function"==typeof s.setLineDash&&s.setLineDash([]),o&&"none"!==a)for(var l=t.symbolFill||i,h=t.symbolStroke||"#ffffff",u=0;u<e.length;u++){var c=e[u];this.drawSymbol(c[0],c[1],a,this.symbolSizeAt(this.renderIndexAt(u)),l,h)}this.endDraw()}}},{key:"renderPoints",value:function renderPoints(){var e=[],t=this.renderCount();this.isEntering()&&(t=Math.max(1,Math.ceil(t*this.progress())));for(var i=0;i<t;i++){var r=this.renderIndexAt(i),n=this.pixels[2*r],a=this.pixels[2*r+1];isFinite(n)&&isFinite(a)&&e.push([n,a])}return e}},{key:"revealedPointCount",value:function revealedPointCount(){return this.rebuildPixels(),this.renderPoints().length}},{key:"drawStraightLine",value:function drawStraightLine(e){for(var t=this.ctx,i=0;i<e.length;i++)0===i?t.moveTo(e[i][0],e[i][1]):t.lineTo(e[i][0],e[i][1])}},{key:"drawSmoothLine",value:function drawSmoothLine(e,t){var i=this.ctx,r=Math.max(.05,Math.min(1,t))/3;if(e.length<2)1===e.length&&i.moveTo(e[0][0],e[0][1]);else{i.moveTo(e[0][0],e[0][1]);for(var n=0;n<e.length-1;n++){var a=n>0?e[n-1]:e[n],o=e[n],s=e[n+1],l=n+2<e.length?e[n+2]:s,h=o[0]+(s[0]-a[0])*r,u=o[1]+(s[1]-a[1])*r,c=s[0]-(l[0]-o[0])*r,d=s[1]-(l[1]-o[1])*r;i.bezierCurveTo(h,u,c,d,s[0],s[1])}}}},{key:"drawArea",value:function drawArea(e,t){var i=this.coord;if(i&&!(t.length<2)){var r=this.ctx;r.beginPath(),r.moveTo(t[0][0],this.baselineYFor(t,0));var n,a=_createForOfIteratorHelper(t);try{for(a.s();!(n=a.n()).done;){var o=_slicedToArray(n.value,2),s=o[0],l=o[1];r.lineTo(s,l)}}catch(e){a.e(e)}finally{a.f()}for(var h=t.length-1;h>=0;h--)r.lineTo(t[h][0],this.baselineYFor(t,h));r.closePath();var u=Number(this.series.option.areaOpacity),c=isFinite(u)?Math.max(0,Math.min(1,u)):.28,d=r.createLinearGradient?r.createLinearGradient(0,0,0,i.plot.height):null;d?(d.addColorStop(0,hexToRgba(e,c)),d.addColorStop(1,hexToRgba(e,.02)),r.fillStyle=d):r.fillStyle=hexToRgba(e,c),r.fill()}}},{key:"baselineYFor",value:function baselineYFor(e,t){var i=this.coord;if(!i)return 0;var r=this.renderIndexAt(t),n=this.effective[2*r];return isFinite(n)?i.yScale.map(n):i.plot.height}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var i=this.pixels.length/2;if(!i)return-1;var r=this.series.option,n=r.hitRadius?Number(r.hitRadius):Math.max(8,this.maxSymbolSize()/2+4);if(i>1024&&this.xMonotonic){var a=this.nearestIndexAtX(e);if(a<0)return-1;for(var o=-1,s=n*n,l=Math.max(0,a-2),h=Math.min(i-1,a+2),u=l;u<=h;u++){var c=this.pixels[2*u],d=this.pixels[2*u+1];if(isFinite(c)&&isFinite(d)){var f=c-e,p=d-t,v=f*f+p*p;v<=s&&(s=v,o=u)}}if(o>=0)return o;for(var m=Math.max(4,this.lineWidthDevice()+4),g=Math.max(0,a-1);g<=Math.min(i-2,a);g++){if(distanceToSegment(e,t,this.pixels[2*g],this.pixels[2*g+1],this.pixels[2*(g+1)],this.pixels[2*(g+1)+1])<=m)return Math.abs(e-this.pixels[2*g])<=Math.abs(e-this.pixels[2*(g+1)])?g:g+1}return-1}for(var b=-1,k=n*n,S=0;S<i;S++){var w=this.pixels[2*S],A=this.pixels[2*S+1];if(isFinite(w)&&isFinite(A)){var _=w-e,M=A-t,C=_*_+M*M;C<=k&&(k=C,b=S)}}if(b>=0)return b;var T=Math.max(4,this.lineWidthDevice()+4),P=-1;return this.eachSegment(function(i,r,n,a,o){P>=0||distanceToSegment(e,t,i,r,n,a)<=T&&(P=Math.abs(e-i)<=Math.abs(e-n)?o:o+1)}),P}}])}();function distanceToSegment(e,t,i,r,n,a){var o=n-i,s=a-r,l=o*o+s*s;if(0===l)return Math.hypot(e-i,t-r);var h=((e-i)*o+(t-r)*s)/l;return h=Math.max(0,Math.min(1,h)),Math.hypot(e-(i+h*o),t-(r+h*s))}function hexToRgba(e,t){if(!e)return"rgba(0,0,0,".concat(t,")");if(0===e.indexOf("rgba"))return e;if(0===e.indexOf("rgb("))return e.replace("rgb(","rgba(").replace(")",",".concat(t,")"));var i=e.replace("#","");if(3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),6!==i.length)return e;var r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return"rgba(".concat(r,",").concat(n,",").concat(a,",").concat(t,")")}var q=function(){function BarSeries(){var e;_classCallCheck(this,BarSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,BarSeries,[].concat(i)),"seriesType","bar"),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"barCacheKey",""),e}return _inherits(BarSeries,G),_createClass(BarSeries,[{key:"isHorizontal",value:function isHorizontal(){var e=this.coord;return!!e&&e.yScale.isBand()&&!e.xScale.isBand()}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord,t=this.series.points.length;if(e){var i=this.buildSeriesKey([t,e.plot.width,e.plot.height,this.isHorizontal()?"h":"v",String(e.yScale.domain.join(","))]);if(i!==this.barCacheKey||this.pixels.length!==2*t){this.barCacheKey=i,this.computeEffective(),this.pixels.length!==2*t&&(this.pixels=new Float64Array(2*t));for(var r=0;r<t;r++){var n=this.barRectAt(r);n?(this.pixels[2*r]=n.x+n.width/2,this.pixels[2*r+1]=n.y+n.height/2):(this.pixels[2*r]=NaN,this.pixels[2*r+1]=NaN)}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"barRectAt",value:function barRectAt(e){var t=this.coord,i=this.series.points[e];if(!t||!i)return null;this.effective.length!==2*this.series.points.length&&this.computeEffective();var r=this.effective[2*e+1],n=this.effective[2*e];if(!isFinite(r))return null;if(this.isHorizontal()){var a=t.yScale.bandStart(i.xValue);if(!isFinite(a))return null;var o=t.yScale.bandwidth()||.6*t.yScale.step(),s=o/Math.max(1,this.barSlot.count),l=this.resolveBarWidth(o,s),h=t.yScale.range[1]>=t.yScale.range[0]?1:-1,u=a+h*(s*this.barSlot.index+(s-l)/2),c=h>0?u:u-l,d=t.xScale.map(n),f=t.xScale.map(r);return isFinite(d)&&isFinite(f)?{x:Math.min(d,f),y:c,width:Math.abs(f-d),height:l}:null}var p=t.xScale.bandStart(i.xValue);if(!isFinite(p))return null;var v=t.xScale.bandwidth()||.6*t.xScale.step(),m=v/Math.max(1,this.barSlot.count),g=this.resolveBarWidth(v,m),b=p+m*this.barSlot.index+(m-g)/2,k=t.yScale.map(n),S=t.yScale.map(r);return isFinite(k)&&isFinite(S)?{x:b,y:Math.min(k,S),width:g,height:Math.abs(S-k)}:null}},{key:"resolveBarWidth",value:function resolveBarWidth(e,t){var i=this.series.option,r=Number(i.barWidth);return!isFinite(r)||r<=0?Math.max(1,t*(1-(isFinite(Number(i.barGap))?Number(i.barGap):.2))):r<=1?Math.max(1,e*r):Math.max(1,r*this.unit())}},{key:"barColorAt",value:function barColorAt(e){var t=this.series.points[e],i=t&&t.raw;return(i&&"object"===_typeof(i)&&!Array.isArray(i)?i.color:void 0)||this.pointColor(e)}},{key:"barDrawRectAt",value:function barDrawRectAt(e,t){var i=this.barRectAt(e),r=this.coord;if(!i||!r)return i;var n=this.hoverBoost(e,.08,t)-1;if(n<=0)return i;var a=this.effective[2*e];if(this.isHorizontal()){var o=i.width*n;return i.x+i.width/2>=r.xScale.map(a)?{x:i.x,y:i.y,width:i.width+o,height:i.height}:{x:i.x-o,y:i.y,width:i.width+o,height:i.height}}var s=i.height*n;return i.y+i.height/2<=r.yScale.map(a)?{x:i.x,y:i.y-s,width:i.width,height:i.height+s}:{x:i.x,y:i.y,width:i.width,height:i.height+s}}},{key:"doRender",value:function doRender(){if(this.rebuildPixels(),this.coord){var e=Number(this.series.option.barRadius),t=this.ctx;this.beginDraw();for(var i=0;i<this.series.points.length;i++){var r=this.barDrawRectAt(i);if(r&&!(r.height<=0)){var n=this.barColorAt(i),a=r;if(t.beginPath(),roundRect(t,a.x,a.y,a.width,a.height,isFinite(e)?e:0),t.createLinearGradient){var o=this.isHorizontal()?t.createLinearGradient(a.x,0,a.x+a.width,0):t.createLinearGradient(0,a.y,0,a.y+a.height);o.addColorStop(0,hexToRgba(n,.95)),o.addColorStop(1,hexToRgba(n,.7)),t.fillStyle=o}else t.fillStyle=n;t.fill()}}this.endDraw()}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();for(var i=this.series.points.length,r=0;r<i;r++){var n=this.barRectAt(r);if(n&&(e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height))return r}return-1}}])}(),$=function(){function AreaSeries(e,t){var i;return _classCallCheck(this,AreaSeries),_defineProperty(i=_callSuper(this,AreaSeries,[e,t]),"seriesType","area"),i.fillArea=!0,i}return _inherits(AreaSeries,Y),_createClass(AreaSeries)}(),Z=function(){function ScatterSeries(){var e;_classCallCheck(this,ScatterSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,ScatterSeries,[].concat(i)),"seriesType","scatter"),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"clipToBox",!0),e}return _inherits(ScatterSeries,G),_createClass(ScatterSeries,[{key:"doRender",value:function doRender(){this.rebuildPixels();var e=this.pixels.length/2;if(e){var t=this.series.option,i=this.pointColor(0),r=t.symbol||"circle",n=t.symbolFill||i,a=t.symbolStroke||"#ffffff";this.beginDraw();var o=this.isEntering();this.computeItemProgress();for(var s=0;s<e;s++){var l=this.pixels[2*s],h=this.pixels[2*s+1];if(isFinite(l)&&isFinite(h)){var u=o?this.itemProgress[s]:1;if(!(u<=0)){var c=this.symbolSizeAt(s)*(o?.2+.8*u:1)*this.hoverBoost(s,.18);o&&u<1&&(this.ctx.globalAlpha=.25+.75*u),this.drawSymbol(l,h,r,c,n,a),o&&u<1&&(this.ctx.globalAlpha=1)}}}this.endDraw()}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var i=this.series.option,r=i.hitRadius?Number(i.hitRadius):this.maxSymbolSize()/2+4,n=r*r,a=-1,o=n,s=this.pixels.length/2;if(s>1024&&this.xMonotonic){var l=this.nearestIndexAtX(e);if(l<0)return-1;for(var h=-1,u=n,c=Math.max(0,l-3);c<=Math.min(s-1,l+3);c++){var d=this.pixels[2*c]-e,f=this.pixels[2*c+1]-t,p=d*d+f*f;p<=u&&(u=p,h=c)}return h}for(var v=0;v<s;v++){var m=this.pixels[2*v],g=this.pixels[2*v+1];if(isFinite(m)&&isFinite(g)){var b=m-e,k=g-t,S=b*b+k*k;S<=o&&(o=S,a=v)}}return a}}])}(),J=2*Math.PI;function normalizeAngle(e){return(e%J+J)%J}function shortestAngleDelta(e,t){var i=normalizeAngle(t-e);return i>Math.PI&&(i-=J),i}var Q=function(){function PieSeries(){var e;_classCallCheck(this,PieSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,PieSeries,[].concat(i)),"seriesType","pie"),_defineProperty(e,"polar",null),_defineProperty(e,"slices",new Float64Array(0)),_defineProperty(e,"pieCacheKey",""),_defineProperty(e,"sliceFrom",null),e}return _inherits(PieSeries,G),_createClass(PieSeries,[{key:"setCoord",value:function setCoord(e){return this.polar=e||null,this.pieCacheKey="",this.markDirty()}},{key:"setHiddenSlices",value:function setHiddenSlices(e){return e.join(",")!==this.hiddenSlices.join(",")&&this.slices.length&&(this.sliceFrom=new Float64Array(this.slices)),_superPropGet(PieSeries,"setHiddenSlices",this,3)([e]),this.pieCacheKey="",this}},{key:"paintPad",value:function paintPad(){var e=this.series.option.label;return e&&!1===e.show?4:48}},{key:"localCenter",value:function localCenter(){var e=this.polar;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.polar,t=this.series.points;if(!e)return this.pixels=new Float64Array(0),void(this.slices=new Float64Array(0));var i=this.series.option,r=[t.length,i.startAngle,i.clockwise,i.roseType,i.radius,i.innerRadius,e.polar.radius,e.plot.width,this.hiddenSlices.join(","),this.progress(),t.length?String(t[0].y):""].join("|");if(r!==this.pieCacheKey){this.pieCacheKey=r;var n=t.length;this.pixels.length!==2*n&&(this.pixels=new Float64Array(2*n)),this.slices.length!==4*n&&(this.slices=new Float64Array(4*n));for(var a=_slicedToArray(this.localCenter(),2),o=a[0],s=a[1],l=e.polar.radius,h=0,u=0,c=0;c<n;c++)if(!(this.hiddenSlices.indexOf(c)>=0)){var d=t[c].y||0;d>0&&(h+=d),d>u&&(u=d)}this.computeItemProgress();for(var f=!1===i.clockwise?-1:1,p=-(void 0===i.startAngle?90:Number(i.startAngle))*Math.PI/180,v=Math.max(0,Math.min(.95,Number(i.innerRadius)||0)),m=i.roseType,g=0;g<n;g++){var b=this.hiddenSlices.indexOf(g)>=0,k=b?0:t[g].y||0,S=p,w=p+f*(h>0?k/h*J*(b?0:this.itemProgress[g]):0);p=w;var A=l;m&&u>0&&(A="area"===m?l*Math.sqrt(Math.max(0,k)/u):l*(Math.max(0,k)/u),A=Math.max(3,A));var _=l*v;this.slices[4*g]=S,this.slices[4*g+1]=w,this.slices[4*g+2]=_,this.slices[4*g+3]=A}this.blendSliceMorph(this.isEntering());for(var M=0;M<n;M++)this.writeCentroid(M,o,s)}}},{key:"blendSliceMorph",value:function blendSliceMorph(e){var t=this.sliceFrom;if(!(!t||e||t.length<this.slices.length)){var i=Math.max(0,Math.min(1,this.progress()));if(i>=1)this.sliceFrom=null;else for(var r=0;r<this.slices.length/4;r++){var n=t[4*r],a=this.slices[4*r],o=n+shortestAngleDelta(n,a)*i,s=t[4*r+1]-n,l=this.slices[4*r+1]-a;this.slices[4*r]=o,this.slices[4*r+1]=o+s+(l-s)*i;for(var h=0,u=[2,3];h<u.length;h++){var c=u[h],d=t[4*r+c];this.slices[4*r+c]=d+(this.slices[4*r+c]-d)*i}}}}},{key:"writeCentroid",value:function writeCentroid(e,t,i){var r=this.slices[4*e],n=this.slices[4*e+1],a=this.slices[4*e+2],o=this.slices[4*e+3];if(Math.abs(n-r)<=1e-9)return this.pixels[2*e]=NaN,void(this.pixels[2*e+1]=NaN);var s=(r+n)/2,l=a+.6*(o-a);this.pixels[2*e]=t+Math.cos(s)*l,this.pixels[2*e+1]=i+Math.sin(s)*l}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.polar;if(!i)return-1;this.rebuildPixels();var r=_slicedToArray(this.localCenter(),2),n=e-r[0],a=t-r[1],o=Math.hypot(n,a);if(o>i.polar.radius+4)return-1;for(var s=this.series.points.length,l=Math.atan2(a,n),h=0;h<s;h++){var u=this.slices[4*h],c=this.slices[4*h+1],d=this.slices[4*h+2],f=this.slices[4*h+3],p=Math.abs(c-u);if(!(p<=1e-9))if(!(o<d-1))if(normalizeAngle(c>u?l-u:u-l)<=p+1e-9&&o<=f+4)return h}return-1}},{key:"doRender",value:function doRender(){var e=this,t=this.polar;if(t){this.rebuildPixels();for(var i=this.ctx,r=_slicedToArray(this.localCenter(),2),n=r[0],a=r[1],o=this.unit(),s=!1===this.series.option.clockwise?-1:1,l=this.series.points.length,h=this.series.option.label,u=!(h&&!1===h.show)&&l>0&&l<=16,c=h&&"inside"===h.position,d=0,f=0;f<l;f++)if(!(this.hiddenSlices.indexOf(f)>=0)){var p=this.series.points[f].y||0;p>0&&(d+=p)}this.beginDraw();for(var v=0;v<l;v++){var m=this.slices[4*v],g=this.slices[4*v+1],b=this.slices[4*v+2],k=this.slices[4*v+3];if(!(Math.abs(g-m)<=1e-9)){var S=this.series.points[v].color||this.series.color,w=this.hoverBoost(v,1),A=w>1?7*(w-1)*this.unit():0,_=(m+g)/2,M=Math.cos(_)*A,C=Math.sin(_)*A;i.beginPath(),b>0?(i.arc(n+M,a+C,k,m,g,s<0),i.arc(n+M,a+C,b,g,m,s>0)):(i.moveTo(n+M,a+C),i.arc(n+M,a+C,k,m,g,s<0)),i.closePath(),i.fillStyle=S,i.fill(),l>1&&(i.strokeStyle="rgba(255,255,255,0.85)",i.lineWidth=o,i.stroke())}}if(u){this.setFont(this.fontSize(),this.fontFamily());for(var T=NaN,P=0,I=[],O=0;O<l;O++){var N=this.slices[4*O],D=this.slices[4*O+1],H=this.slices[4*O+2],R=this.slices[4*O+3];if(!(Math.abs(D-N)<=1e-9)){var E=this.series.points[O],L=E.y||0,z=t.polar.radius,B=d>0?L/d*100:0,W={name:E.name||"".concat(this.series.name," ").concat(O+1),value:E.y,percent:B,dataIndex:O,seriesId:this.series.id,seriesName:this.series.name,color:E.color||this.series.color},V=h&&"function"==typeof h.formatter?String(h.formatter(W)):"".concat(W.name," ").concat(B.toFixed(1),"%"),j=(N+D)/2;if(c){if(isFinite(T))P=Math.abs(Math.atan2(Math.sin(j-T),Math.cos(j-T)))<.42?Math.min(3,P+1):0;else P=0;T=j;var U=H+.62*(R-H)+P*(this.fontSize()+4),X=Math.abs(D-N)*U;if(measureTextWidth(this.ctx,V,this.fontSize(),this.fontFamily())<=X+6){i.textAlign="center",i.textBaseline="middle",i.fillStyle="#ffffff",i.fillText(V,n+Math.cos(j)*U,a+Math.sin(j)*U);continue}}var K=z+8,G=z+26,Y=Math.cos(j)>=0;I.push({x1:n+Math.cos(j)*R,y1:a+Math.sin(j)*R,x2:n+Math.cos(j)*K,y2:a+Math.sin(j)*K,x3:n+Math.cos(j)*G+(Y?8:-8),y3:a+Math.sin(j)*G,text:V,right:Y})}}for(var q=1.45*this.fontSize(),$=function _loop(){for(var r=J[Z],n=I.filter(function(e){return e.right===r}).sort(function(e,t){return e.y3-t.y3}),s=1;s<n.length;s++)n[s].y3-n[s-1].y3<q&&(n[s].y3=n[s-1].y3+q);if(n.length){var l=n[n.length-1].y3-(a+t.polar.radius+2*q);if(l>0){var h,u=_createForOfIteratorHelper(n);try{for(u.s();!(h=u.n()).done;){h.value.y3-=l}}catch(e){u.e(e)}finally{u.f()}}}var c,d=_createForOfIteratorHelper(n);try{for(d.s();!(c=d.n()).done;){var f=c.value;i.strokeStyle="rgba(148,163,184,0.9)",i.lineWidth=o,i.beginPath(),i.moveTo(f.x1,f.y1),i.lineTo(f.x2,f.y2),i.lineTo(f.x2,f.y3),i.lineTo(f.x3,f.y3),i.stroke(),i.textAlign=f.right?"left":"right",i.textBaseline="middle",i.fillStyle=e.chartTheme&&e.chartTheme.axisLabelColor||"#475569",i.fillText(f.text,f.x3+(f.right?4:-4)*o,f.y3)}}catch(e){d.e(e)}finally{d.f()}},Z=0,J=[!0,!1];Z<J.length;Z++)$()}this.endDraw()}}},{key:"fontSize",value:function fontSize(){return this.chartTheme&&this.chartTheme.fontSize||12}},{key:"fontFamily",value:function fontFamily(){return this.chartTheme&&this.chartTheme.fontFamily||"Arial"}}])}(),ee=function(){function RadarSeries(){var e;_classCallCheck(this,RadarSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,RadarSeries,[].concat(i)),"seriesType","radar"),_defineProperty(e,"radar",null),_defineProperty(e,"radarCacheKey",""),e}return _inherits(RadarSeries,G),_createClass(RadarSeries,[{key:"setCoord",value:function setCoord(e){return this.radar=e||null,this.radarCacheKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 14}},{key:"localCenter",value:function localCenter(){var e=this.radar;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.radar,t=this.series.points,i=t.length;if(e){var r=[i,e.polar.radius,e.plot.width,this.progress(),e.domains.map(function(e){return e.join(":")}).join("|")].join("::");if(r!==this.radarCacheKey||this.pixels.length!==2*i){this.radarCacheKey=r,this.pixels.length!==2*i&&(this.pixels=new Float64Array(2*i));for(var n=_slicedToArray(this.localCenter(),2),a=n[0],o=n[1],s=this.progress(),l=0;l<i;l++){var h=-Math.PI/2+l/Math.max(1,i)*Math.PI*2,u=e.domains[l]||[0,1],c=t[l].y,d=null==c?u[0]:c,f=u[1]-u[0],p=f>0?(d-u[0])/f:0;p=Math.max(0,Math.min(1,p)),p*=s;var v=e.polar.radius*p;this.pixels[2*l]=a+Math.cos(h)*v,this.pixels[2*l+1]=o+Math.sin(h)*v}}}else this.pixels=new Float64Array(0)}},{key:"doRender",value:function doRender(){if(this.radar){this.rebuildPixels();var e=this.pixels.length/2;if(e){var t=this.ctx,i=this.pointColor(0),r=this.unit(),n=_slicedToArray(this.localCenter(),2);n[0],n[1],this.beginDraw(),t.beginPath();for(var a=0;a<e;a++){var o=this.pixels[2*a],s=this.pixels[2*a+1];0===a?t.moveTo(o,s):t.lineTo(o,s)}t.closePath(),t.fillStyle=hexToRgba(i,.22),t.fill(),t.strokeStyle=i,t.lineWidth=this.lineWidthDevice()*r,t.stroke();for(var l=0;l<e;l++){var h=this.hoverBoost(l,.3);this.drawSymbol(this.pixels[2*l],this.pixels[2*l+1],"circle",this.symbolSizeAt(l)*h,i,"#ffffff")}this.endDraw()}}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var i=this.pixels.length/2;if(!i)return-1;for(var r=this.series.option,n=r.hitRadius?Number(r.hitRadius):24,a=-1,o=n*n,s=0;s<i;s++){var l=this.pixels[2*s]-e,h=this.pixels[2*s+1]-t,u=l*l+h*h;u<=o&&(o=u,a=s)}if(a>=0)return a;if(this.containsPointInPolygon(e,t)){var c=_slicedToArray(this.localCenter(),2),d=c[0],f=c[1],p=Math.atan2(t-f,e-d),v=2*Math.PI/i,m=((p+Math.PI/2)%(2*Math.PI)+2*Math.PI)%(2*Math.PI);return Math.round(m/v)%i}return-1}},{key:"containsPointInPolygon",value:function containsPointInPolygon(e,t){for(var i=this.pixels.length/2,r=!1,n=0,a=i-1;n<i;a=n++){var o=this.pixels[2*n],s=this.pixels[2*n+1],l=this.pixels[2*a],h=this.pixels[2*a+1];s>t!=h>t&&e<(l-o)*(t-s)/(h-s)+o&&(r=!r)}return r}}])}(),te=function(){function CandlestickSeries(){var e;_classCallCheck(this,CandlestickSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,CandlestickSeries,[].concat(i)),"seriesType","candlestick"),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"clipToBox",!0),e}return _inherits(CandlestickSeries,G),_createClass(CandlestickSeries,[{key:"hitTestIndex",value:function hitTestIndex(e,t){for(var i=this.candleRects(),r=0;r<i.length;r++){var n=i[r];if(n&&(e>=n.x-2&&e<=n.x+n.width+2&&t>=n.y-2&&t<=n.y+n.height+2))return r}return-1}},{key:"candleRects",value:function candleRects(){var e=this.coord;if(!e)return[];for(var t=[],i=e.xScale.bandwidth()||.6*e.xScale.step(),r=this.resolveBodyWidth(i),n=0;n<this.series.points.length;n++){var a=this.series.points[n];if(a.ohlc){var o=(e.xScale.isBand(),e.xScale.map(a.xValue));if(isFinite(o)){var s=e.yScale.map(a.ohlc[3]),l=e.yScale.map(a.ohlc[2]);isFinite(s)&&isFinite(l)?t.push({x:o-r/2,y:Math.min(s,l),width:r,height:Math.abs(l-s)}):t.push(null)}else t.push(null)}else t.push(null)}return t}},{key:"resolveBodyWidth",value:function resolveBodyWidth(e){var t=Number(this.series.option.barWidth);return!isFinite(t)||t<=0?Math.max(2,.6*e):t<=1?Math.max(2,e*t):Math.max(2,t*this.unit())}},{key:"doRender",value:function doRender(){var e=this,t=this.coord;if(t){var i=this.ctx,r=this.unit(),n=this.series.option.candle||{},a=n.upColor||"#EF4444",o=n.downColor||"#10B981",s=Math.max(r,(Number(n.borderWidth)||1)*r),l=t.xScale.bandwidth()||.6*t.xScale.step(),h=this.resolveBodyWidth(l),u=this.candleRects(),c=this.isEntering();this.computeItemProgress(),this.beginDraw();for(var d=function _loop(){var r=e.series.points[f],n=u[f];if(!r.ohlc||!n)return 0;var l=_slicedToArray(r.ohlc,4),d=l[0],p=l[1],v=l[2],m=l[3],g=p>=d,b=g?a:o,k=n.x+n.width/2,S=c?e.itemProgress[f]:1;if(S<=0)return 0;var w=t.yScale.map(d),A=t.yScale.map(p),_=t.yScale.map(v),M=t.yScale.map(m),C=w,T=function lerp(e){return C+(e-C)*S};i.beginPath(),i.moveTo(k,T(M)),i.lineTo(k,T(_)),i.strokeStyle=b,i.lineWidth=s,i.stroke();var P=T(A),I=Math.min(w,P),O=Math.max(s,Math.abs(P-w));i.beginPath(),i.rect(k-h/2,I,h,O),i.fillStyle=b,i.globalAlpha=g?.55:.95,i.fill(),i.globalAlpha=1,i.strokeStyle=b,i.lineWidth=s,i.stroke()},f=0;f<this.series.points.length;f++)d();if(null!==this.hoverIndex){var p=u[this.hoverIndex];p&&this.drawHoverOverlay(this.hoverIndex,p,{radius:2,fill:"rgba(255,255,255,0.10)"})}this.endDraw()}}}])}(),ie=function(){function HeatmapSeries(){var e;_classCallCheck(this,HeatmapSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,HeatmapSeries,[].concat(i)),"seriesType","heatmap"),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"heatCacheKey",""),e}return _inherits(HeatmapSeries,G),_createClass(HeatmapSeries,[{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord,t=this.series.points.length;if(e){var i=this.buildSeriesKey([t,e.plot.width,e.plot.height,String(e.yScale.domain.join(","))]);if(i!==this.heatCacheKey||this.pixels.length!==2*t){this.heatCacheKey=i,this.pixels.length!==2*t&&(this.pixels=new Float64Array(2*t));for(var r=0;r<t;r++){var n=this.cellRectAt(r);n?(this.pixels[2*r]=n.x+n.width/2,this.pixels[2*r+1]=n.y+n.height/2):(this.pixels[2*r]=NaN,this.pixels[2*r+1]=NaN)}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"valueRange",value:function valueRange(){var e,t=1/0,i=-1/0,r=_createForOfIteratorHelper(this.series.points);try{for(r.s();!(e=r.n()).done;){var n=e.value;null!==n.y&&isFinite(n.y)&&(n.y<t&&(t=n.y),n.y>i&&(i=n.y))}}catch(e){r.e(e)}finally{r.f()}return isFinite(t)&&isFinite(i)?t===i?[t,t+1]:[t,i]:[0,1]}},{key:"cellRectAt",value:function cellRectAt(e){var t=this.coord,i=this.series.points[e];if(!t||!i)return null;var r=t.xScale.bandStart(i.xValue,void 0),n=void 0===i.name?i.index:i.name,a=t.yScale.bandStart(n,void 0);if(!isFinite(r)||!isFinite(a))return null;var o=t.xScale.bandwidth()||.8*t.xScale.step(),s=t.yScale.bandwidth()||.8*t.yScale.step(),l=t.xScale.range[1]>=t.xScale.range[0]?1:-1,h=t.yScale.range[1]>=t.yScale.range[0]?1:-1,u=Math.max(1,o),c=Math.max(1,s);return{x:l>0?r:r-u,y:h>0?a:a-c,width:u,height:c}}},{key:"doRender",value:function doRender(){var e=this.coord;if(e){var t=this.ctx,i=_slicedToArray(this.valueRange(),2),r=i[0],n=i[1],a=this.series.option.heatmap||{},o=a.minColor||"#EFF6FF",s=a.maxColor||this.series.color,l=this.isEntering();this.computeItemProgress();var h=e.xScale.domain.length||1;this.beginDraw();for(var u=0;u<this.series.points.length;u++){var c=this.series.points[u],d=this.cellRectAt(u);if(d){var f=null===c.y?0:(c.y-r)/(n-r||1),p=1;if(l){var v=(u%h+Math.floor(u/h))%Math.max(1,h)/Math.max(1,h),m=this.progress();if((p=Math.max(0,Math.min(1,(m-v*(this.stagger||.35))/Math.max(.05,1-v*(this.stagger||.35)))))<=0)continue;t.globalAlpha=p}t.fillStyle=mixColors(o,s,Math.max(0,Math.min(1,f))),t.fillRect(d.x,d.y,d.width,d.height),l&&(t.globalAlpha=1)}}null!==this.hoverIndex&&this.drawHoverOverlay(this.hoverIndex,this.cellRectAt(this.hoverIndex),{radius:0}),this.endDraw()}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){for(var i=0;i<this.series.points.length;i++){var r=this.cellRectAt(i);if(r&&(e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height))return i}return-1}},{key:"paintPad",value:function paintPad(){return 4}}])}();function mixColors(e,t,i){var r=parseHex$1(e),n=parseHex$1(t);if(!r||!n)return t;var a=Math.round(r[0]+(n[0]-r[0])*i),o=Math.round(r[1]+(n[1]-r[1])*i),s=Math.round(r[2]+(n[2]-r[2])*i);return"rgb(".concat(a,",").concat(o,",").concat(s,")")}function parseHex$1(e){if("string"!=typeof e)return null;var t=e.trim();if(0===t.indexOf("#"))return 3===(t=t.slice(1)).length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?null:[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];var i=t.match(/rgba?\(([^)]+)\)/);if(i){var r=i[1].split(",").map(function(e){return parseFloat(e)});return[r[0]||0,r[1]||0,r[2]||0]}return null}function layoutSankey(e,i,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{nodes:[],links:[]},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t,o=e.length;if(!o)return{nodes:[],links:[]};var s,l=Math.max(2,Number(n.nodeWidth)||16),h=Math.max(0,Number(n.nodePadding)||10),u=Math.max(0,void 0===Number(n.iterations)?6:Number(n.iterations)),c=function indexOf(t){return"number"==typeof t?t>=0&&t<o?t:-1:e.findIndex(function(e){return e.name===t})},d=i.map(function(e,t){return{id:t,source:c(e.source),target:c(e.target),value:Math.max(0,Number(e.value)||0),color:e.color}}).filter(function(e){return e.source>=0&&e.target>=0&&e.value>0}),f=e.map(function(){return[]}),p=e.map(function(){return[]}),v=new Array(o).fill(0),m=_createForOfIteratorHelper(d);try{for(m.s();!(s=m.n()).done;){var g=s.value;f[g.source].push(g.target),p[g.target].push(g.source),v[g.target]++}}catch(e){m.e(e)}finally{m.f()}for(var b=new Array(o).fill(0),k=[],S=0;S<o;S++)0===v[S]&&k.push(S);for(;k.length;){var w,A=k.shift(),_=_createForOfIteratorHelper(f[A]);try{for(_.s();!(w=_.n()).done;){var M=w.value;b[M]=Math.max(b[M],b[A]+1),0===--v[M]&&k.push(M)}}catch(e){_.e(e)}finally{_.f()}}for(var C=0;C<o;C++)void 0!==e[C].depth&&(b[C]=Math.max(0,Number(e[C].depth)||0));var T,P=Math.max.apply(Math,[1].concat(_toConsumableArray(b))),I=function columnX(e){return r.x+e*(r.width-l)/P},O=new Array(o).fill(0),N=new Array(o).fill(0),D=_createForOfIteratorHelper(d);try{for(D.s();!(T=D.n()).done;){var H=T.value;N[H.source]+=H.value,O[H.target]+=H.value}}catch(e){D.e(e)}finally{D.f()}for(var R=new Array(o).fill(0).map(function(e,t){return Math.max(O[t],N[t])}),E=new Array(P+1).fill(0),L=0;L<o;L++){E[b[L]]+=R[L]}for(var z=new Array(P+1).fill(0),B=0;B<o;B++)z[b[B]]++;var W,V=E.map(function(e,t){var i=r.height-h*Math.max(0,z[t]-1);return e>0?Math.max(1,i)/e:1}),j=e.map(function(e,t){var i=Math.max(2,R[t]*V[b[t]]);return{id:t,name:e.name,depth:b[t],x:I(b[t]),y:r.y,width:l,height:i,value:R[t],color:e.color||a[t%a.length]}}),U=new Array(P+1).fill(0).map(function(){return[]}),X=_createForOfIteratorHelper(j);try{for(X.s();!(W=X.n()).done;){var K=W.value;U[K.depth].push(K.id)}}catch(e){X.e(e)}finally{X.f()}var G,Y=_createForOfIteratorHelper(U);try{for(Y.s();!(G=Y.n()).done;){var q,$=G.value,Z=r.y,J=_createForOfIteratorHelper($);try{for(J.s();!(q=J.n()).done;){var Q=q.value;j[Q].y=Z,Z+=j[Q].height+h}}catch(e){J.e(e)}finally{J.f()}}}catch(e){Y.e(e)}finally{Y.f()}for(var ee=0;ee<u;ee++){var te,ie=_createForOfIteratorHelper(j);try{for(ie.s();!(te=ie.n()).done;){var re,ne=te.value,ae=[],oe=_createForOfIteratorHelper(d);try{for(oe.s();!(re=oe.n()).done;){var se=re.value;se.source===ne.id?ae.push({id:se.target,weight:se.value}):se.target===ne.id&&ae.push({id:se.source,weight:se.value})}}catch(e){oe.e(e)}finally{oe.f()}if(ae.length){for(var le=0,he=0,ue=0,ce=ae;ue<ce.length;ue++){var de=ce[ue],fe=j[de.id];he+=(fe.y+fe.height/2)*de.weight,le+=de.weight}var pe=le>0?he/le:ne.y+ne.height/2;ne.y=pe-ne.height/2}}}catch(e){ie.e(e)}finally{ie.f()}var ve,ye=_createForOfIteratorHelper(U);try{for(ye.s();!(ve=ye.n()).done;){var me=ve.value;me.sort(function(e,t){return j[e].y-j[t].y});var xe,ge=r.y,be=_createForOfIteratorHelper(me);try{for(be.s();!(xe=be.n()).done;){var ke=xe.value;j[ke].y=ge,ge+=j[ke].height+h}}catch(e){be.e(e)}finally{be.f()}}}catch(e){ye.e(e)}finally{ye.f()}}var Se,we=_createForOfIteratorHelper(U);try{for(we.s();!(Se=we.n()).done;){var Ae=Se.value,_e=Ae.length?j[Ae[Ae.length-1]].y+j[Ae[Ae.length-1]].height-(r.y+r.height):0;if(_e>0){var Me,Ce=_createForOfIteratorHelper(Ae);try{for(Ce.s();!(Me=Ce.n()).done;){var Te=Me.value;j[Te].y=Math.max(r.y,j[Te].y-_e)}}catch(e){Ce.e(e)}finally{Ce.f()}}}}catch(e){we.e(e)}finally{we.f()}var Pe,Fe=new Array(o).fill(0),Ie=new Array(o).fill(0),Oe=[],Ne=_createForOfIteratorHelper(d.slice().sort(function(e,t){return e.source-t.source||e.target-t.target}));try{for(Ne.s();!(Pe=Ne.n()).done;){var De=Pe.value,He=j[De.source],Re=j[De.target],Ee=He.value>0?He.height/He.value:0,Le=Re.value>0?Re.height/Re.value:0,ze=Math.max(1,De.value*Math.min(Ee,Le)),Be=He.y+Fe[De.source],We=Re.y+Ie[De.target];Fe[De.source]+=ze,Ie[De.target]+=ze,Oe.push({id:De.id,source:De.source,target:De.target,value:De.value,width:ze,sy:Be,ty:We,color:De.color||He.color})}}catch(e){Ne.e(e)}finally{Ne.f()}return{nodes:j,links:Oe}}function sampleLinkPath(e,t,i){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:16,a=[],o=e.sy+e.width/2-r,s=e.ty+e.width/2-r,l=t+.5*(i-t),h=i-.5*(i-t),u=0;u<=n;u++){var c=u/n,d=1-c,f=d*d*d*t+3*d*d*c*l+3*d*c*c*h+c*c*c*i,p=d*d*d*o+3*d*d*c*o+3*d*c*c*s+c*c*c*s;a.push([f,p])}return a}var re=function(){function SankeySeries(){var e;_classCallCheck(this,SankeySeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,SankeySeries,[].concat(i)),"seriesType","sankey"),_defineProperty(e,"sankey",null),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"sankeyCacheKey",""),e}return _inherits(SankeySeries,G),_createClass(SankeySeries,[{key:"setCoord",value:function setCoord(e){return this.sankey=e||null,this.sankeyCacheKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 24}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.sankey;if(e){var t=e.layout,i=t.nodes,r=t.links,n=i.length+r.length,a=[e.plot.x,e.plot.y],o=a[0],s=a[1],l=this.buildSeriesKey([n,o,s,e.plot.width,e.plot.height,i.length,r.length]);if(l!==this.sankeyCacheKey||this.pixels.length!==2*n){this.sankeyCacheKey=l,this.pixels=new Float64Array(2*n);var h,u=_createForOfIteratorHelper(i);try{for(u.s();!(h=u.n()).done;){var c=h.value;this.pixels[2*c.id]=c.x-o+c.width/2,this.pixels[2*c.id+1]=c.y-s+c.height/2}}catch(e){u.e(e)}finally{u.f()}var d,f=_createForOfIteratorHelper(r);try{for(f.s();!(d=f.n()).done;){var p=d.value,v=i[p.source],m=i[p.target];if(v&&m){var g=i.length+p.id;this.pixels[2*g]=(v.x+v.width+m.x)/2-o,this.pixels[2*g+1]=(p.sy+p.ty)/2+p.width/2-s}}}catch(e){f.e(e)}finally{f.f()}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"doRender",value:function doRender(){var e=this.sankey;if(e){var t=e.layout,i=t.nodes,r=t.links,n=this.ctx,a=e.plot,o=this.unit();this.beginDraw();var s=e.options.flow;s?this.keepAnimating():this.stopAnimating();var l=Number(e.options.linkOpacity);n.globalAlpha=isFinite(l)?Math.max(0,Math.min(1,l)):.42;var h,u=_createForOfIteratorHelper(r);try{for(u.s();!(h=u.n()).done;){var c=h.value,d=i[c.source],f=i[c.target];if(d&&f){var p=d.x-a.x+d.width,v=f.x-a.x,m=c.sy-a.y,g=c.ty-a.y,b=p+.5*(v-p),k=v-.5*(v-p);if(n.beginPath(),n.moveTo(p,m),n.bezierCurveTo(b,m,k,g,v,g),n.lineTo(v,g+c.width),n.bezierCurveTo(k,g+c.width,b,m+c.width,p,m+c.width),n.closePath(),n.fillStyle=c.color,n.fill(),s){var S=Number(e.options.flowSpeed)||40;if(n.save(),n.globalAlpha=.9,n.beginPath(),n.moveTo(p,(m+g)/2),n.bezierCurveTo(b,(m+g)/2,k,(m+g)/2,v,(m+g)/2),n.strokeStyle="#ffffff",n.lineWidth=Math.max(o,Math.min(5*o,.28*c.width)),"function"==typeof n.setLineDash){var w=[6*o,10*o];n.setLineDash(w),"number"==typeof n.lineDashOffset&&(n.lineDashOffset=-Date.now()/1e3*S%(w[0]+w[1]))}n.stroke(),"function"==typeof n.setLineDash&&n.setLineDash([]),n.restore()}}}}catch(e){u.e(e)}finally{u.f()}n.globalAlpha=1;var A,_=_createForOfIteratorHelper(i);try{for(_.s();!(A=_.n()).done;){var M=A.value;n.beginPath();var C=M.x-a.x,T=M.y-a.y,P=Math.min(3,M.width/2);n.moveTo(C+P,T),n.lineTo(C+M.width-P,T),n.arcTo(C+M.width,T,C+M.width,T+P,P),n.lineTo(C+M.width,T+M.height-P),n.arcTo(C+M.width,T+M.height,C+M.width-P,T+M.height,P),n.lineTo(C+P,T+M.height),n.arcTo(C,T+M.height,C,T+M.height-P,P),n.lineTo(C,T+P),n.arcTo(C,T,C+P,T,P),n.closePath(),n.fillStyle=M.color,n.fill(),n.strokeStyle="rgba(255,255,255,0.75)",n.lineWidth=o,n.stroke()}}catch(e){_.e(e)}finally{_.f()}if(!e.options.label||!1!==e.options.label.show){var I=this.chartTheme;if(I){this.setFont(I.fontSize,I.fontFamily),n.fillStyle=I.textColor,n.textBaseline="middle";var O,N=Math.max.apply(Math,_toConsumableArray(i.map(function(e){return e.depth})).concat([0])),D=_createForOfIteratorHelper(i);try{for(D.s();!(O=D.n()).done;){var H=O.value,R=H.x-a.x,E=H.y-a.y+H.height/2;H.depth>=N?(n.textAlign="right",this.fillLabelWithHalo(H.name,R-6*o,E)):(n.textAlign="left",this.fillLabelWithHalo(H.name,R+H.width+6*o,E))}}catch(e){D.e(e)}finally{D.f()}}}this.endDraw()}}},{key:"fillLabelWithHalo",value:function fillLabelWithHalo(e,t,i){var r=this.ctx,n=this.chartTheme;r.lineWidth=3*this.unit(),r.strokeStyle=n&&n.labelHaloColor||"rgba(255,255,255,0.85)",r.lineJoin="round",r.strokeText(e,t,i),r.fillStyle=n&&n.textColor||"#212529",r.fillText(e,t,i)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.sankey;if(!i)return-1;var r,n=i.layout,a=n.nodes,o=n.links,s=i.plot,l=_createForOfIteratorHelper(a);try{for(l.s();!(r=l.n()).done;){var h=r.value,u=h.x-s.x,c=h.y-s.y;if(e>=u-2&&e<=u+h.width+2&&t>=c-2&&t<=c+h.height+2)return h.id}}catch(e){l.e(e)}finally{l.f()}var d,f=_createForOfIteratorHelper(o);try{for(f.s();!(d=f.n()).done;){var p=d.value,v=a[p.source],m=a[p.target];if(v&&m)for(var g=sampleLinkPath(p,v.x-s.x+v.width,m.x-s.x,s.y,12),b=1;b<g.length;b++){if(distanceToSegment(e,t,g[b-1][0],g[b-1][1],g[b][0],g[b][1])<=6)return a.length+p.id}}}catch(e){f.e(e)}finally{f.f()}return-1}}])}(),ne=function(){function FunnelSeries(){var e;_classCallCheck(this,FunnelSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,FunnelSeries,[].concat(i)),"seriesType","funnel"),_defineProperty(e,"funnel",null),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"stageGeom",[]),_defineProperty(e,"stageRects",[]),_defineProperty(e,"funnelKey",""),_defineProperty(e,"stageFrom",null),e}return _inherits(FunnelSeries,G),_createClass(FunnelSeries,[{key:"setHiddenSlices",value:function setHiddenSlices(e){return e.join(",")!==this.hiddenSlices.join(",")&&this.stageGeom.length&&(this.stageFrom=this.stageGeom.map(function(e){return e?_objectSpread2({},e):null})),_superPropGet(FunnelSeries,"setHiddenSlices",this,3)([e]),this.funnelKey="",this}},{key:"setCoord",value:function setCoord(e){return this.funnel=e||null,this.funnelKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 12}},{key:"highlightRectAt",value:function highlightRectAt(e){return this.rebuildPixels(),this.stageRects[e]||null}},{key:"widthAt",value:function widthAt(e,t){var i=e.y1-e.y0||1,r=Math.max(0,Math.min(1,(t-e.y0)/i));return e.topWidth+(e.bottomWidth-e.topWidth)*r}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.funnel,t=this.series.points,i=t.length;if(!e||!i)return this.pixels=new Float64Array(0),this.stageGeom=[],void(this.stageRects=[]);var r=e.options||{},n=this.buildSeriesKey([i,e.plot.width,e.plot.height,r.sort,r.minSize,r.trapezoid,this.hiddenSlices.join(",")]);if(n!==this.funnelKey||this.pixels.length!==2*i){this.funnelKey=n,this.pixels.length!==2*i&&(this.pixels=new Float64Array(2*i)),this.stageGeom=new Array(i).fill(null),this.stageRects=new Array(i).fill(null);for(var a=[],o=0;o<i;o++)this.hiddenSlices.indexOf(o)>=0||null!==t[o].y&&a.push(o);var s=r.sort||"descending";if("none"!==s&&a.sort(function(e,i){return"ascending"===s?(t[e].y||0)-(t[i].y||0):(t[i].y||0)-(t[e].y||0)}),a.length){for(var l=Math.max(0,Number(r.gap)||2),h=Math.max(4,(e.plot.height-l*(a.length-1))/a.length),u=Math.max.apply(Math,_toConsumableArray(a.map(function(e){return t[e].y||0})).concat([0])),c=Math.max(0,Math.min(1,void 0===r.minSize?.12:Number(r.minSize))),d=e.plot.width,f=e.plot.width/2,p=this.isEntering()?Math.max(0,Math.min(1,this.progress())):1,v=.72*d,m=a.map(function(e){var i=t[e].y||0,r=u>0?i/u:1,n=Math.max(d*c,d*Math.max(0,Math.min(1,r)));return v+(n-v)*p}),g=!1!==r.trapezoid,b=0;b<a.length;b++){var k=a[b],S=b*(h+l),w=S+h,A=m[b],_=g&&b+1<m.length?m[b+1]:m[b],M={y0:S,y1:w,topWidth:A,bottomWidth:_,cx:f};this.stageGeom[k]=M;var C=Math.max(A,_)/2;this.stageRects[k]={x:f-C,y:S,width:2*C,height:w-S},this.pixels[2*k]=f,this.pixels[2*k+1]=(S+w)/2}this.blendStageMorph(),this.xMonotonic=!1,this.renderIndices=null}}}},{key:"blendStageMorph",value:function blendStageMorph(){var e=this.stageFrom;if(e&&!this.isEntering()){var t=Math.max(0,Math.min(1,this.progress()));if(t>=1)this.stageFrom=null;else for(var i=0;i<this.stageGeom.length;i++){var r=this.stageGeom[i],n=e[i];if(r&&n){var a=function lerp(e,i){return e+(i-e)*t};r.y0=a(n.y0,r.y0),r.y1=a(n.y1,r.y1),r.topWidth=a(n.topWidth,r.topWidth),r.bottomWidth=a(n.bottomWidth,r.bottomWidth);var o=Math.max(r.topWidth,r.bottomWidth)/2;this.stageRects[i]={x:r.cx-o,y:r.y0,width:2*o,height:r.y1-r.y0},this.pixels[2*i]=r.cx,this.pixels[2*i+1]=(r.y0+r.y1)/2}}}}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();for(var i=0;i<this.stageGeom.length;i++){var r=this.stageGeom[i];if(r&&!(t<r.y0-1||t>r.y1+1)){var n=this.widthAt(r,t)/2*this.hoverBoost(i,.06)+1;if(Math.abs(e-r.cx)<=n)return i}}return-1}},{key:"doRender",value:function doRender(){var e=this.funnel;if(e&&this.chartTheme){this.rebuildPixels();for(var t=this.ctx,i=this.unit(),r=this.chartTheme,n=(e.options||{}).labelPosition||"inside",a=0,o=0;o<this.stageGeom.length;o++)this.stageGeom[o]&&a++;for(var s=0,l=0;l<this.series.points.length;l++)this.stageGeom[l]&&(s+=this.series.points[l].y||0);this.beginDraw();for(var h=0;h<this.stageGeom.length;h++){var u=this.stageGeom[h];if(u){var c=this.series.points[h].color||this.series.color,d=this.hoverBoost(h,.06),f=u.topWidth*d,p=u.bottomWidth*d;t.beginPath(),t.moveTo(u.cx-f/2,u.y0),t.lineTo(u.cx+f/2,u.y0),t.lineTo(u.cx+p/2,u.y1),t.lineTo(u.cx-p/2,u.y1),t.closePath();var v=t.createLinearGradient(0,u.y0,0,u.y1);v.addColorStop(0,hexToRgba(c,.95)),v.addColorStop(1,hexToRgba(c,.75)),t.fillStyle=v,t.fill(),t.strokeStyle="rgba(255,255,255,0.7)",t.lineWidth=i,t.stroke()}}this.setFont(r.fontSize,r.fontFamily),t.textBaseline="middle";for(var m=0;m<this.stageGeom.length;m++){var g=this.stageGeom[m];if(g){var b=this.series.points[m],k=b.y||0,S=s>0?k/s*100:0,w="".concat(b.name||b.xValue," ").concat(k).concat(a>1?" ".concat(S.toFixed(1),"%"):""),A=(g.y0+g.y1)/2,_=this.widthAt(g,A);if("right"!==n)measureTextWidth(t,w,r.fontSize,r.fontFamily)+12>_?(t.textAlign="left",t.fillStyle=r.textColor,t.fillText(w,g.cx+Math.max(g.topWidth,g.bottomWidth)/2+8*i,A)):(t.textAlign="center",t.fillStyle="#ffffff",t.fillText(w,g.cx,A));else t.textAlign="left",t.fillStyle=r.textColor,t.fillText(w,g.cx+Math.max(g.topWidth,g.bottomWidth)/2+8*i,A)}}this.endDraw()}}}])}(),ae=2*Math.PI,oe=Math.PI/180,se=function(){function GaugeSeries(){var e;_classCallCheck(this,GaugeSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,GaugeSeries,[].concat(i)),"seriesType","gauge"),_defineProperty(e,"gauge",null),_defineProperty(e,"gaugeKey",""),_defineProperty(e,"fromValue",null),e}return _inherits(GaugeSeries,G),_createClass(GaugeSeries,[{key:"setCoord",value:function setCoord(e){return this.gauge=e||null,this.gaugeKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 8}},{key:"updateSeries",value:function updateSeries(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t&&this.gauge&&(this.fromValue=this.renderedValue()),_superPropGet(GaugeSeries,"updateSeries",this,3)([e,t,i])}},{key:"renderedValue",value:function renderedValue(){var e=this.range().min,t=this.series.points.length&&Number(this.series.points[0].y)||0,i=Math.max(0,Math.min(1,this.progress())),r=null===this.fromValue?e:this.fromValue;return r+(t-r)*i}},{key:"angles",value:function angles(){for(var e=this.gauge&&this.gauge.options||{},t=void 0===e.startAngle?225:Number(e.startAngle),i=void 0===e.endAngle?-45:Number(e.endAngle),r=-t*oe,n=-i*oe;n<=r;)n+=ae;return{a0:r,a1:n,sweep:n-r}}},{key:"range",value:function range(){var e=this.gauge&&this.gauge.options||{},t=isFinite(Number(e.min))?Number(e.min):0,i=isFinite(Number(e.max))?Number(e.max):100;return{min:t,max:i>t?i:t+1}}},{key:"angleFor",value:function angleFor(e){var t=this.angles(),i=t.a0,r=t.sweep,n=this.range(),a=n.min,o=n.max;return i+Math.max(0,Math.min(1,(e-a)/(o-a)))*r}},{key:"localCenter",value:function localCenter(){var e=this.gauge;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.gauge;if(e){var t=e.options||{},i=this.series.points.length&&Number(this.series.points[0].y)||0,r=this.buildSeriesKey([e.polar.radius,t.startAngle,t.endAngle,t.min,t.max,i]);if(r!==this.gaugeKey||2!==this.pixels.length){this.gaugeKey=r,2!==this.pixels.length&&(this.pixels=new Float64Array(2));var n=_slicedToArray(this.localCenter(),2),a=n[0],o=n[1],s=Number(t.pointer&&t.pointer.length||.72)*e.polar.radius,l=this.angleFor(i);this.pixels[0]=a+Math.cos(l)*s,this.pixels[1]=o+Math.sin(l)*s,this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.gauge;if(!i||!this.series.points.length)return-1;var r=_slicedToArray(this.localCenter(),2),n=r[0],a=r[1];return Math.hypot(e-n,t-a)<=i.polar.radius+12?0:-1}},{key:"doRender",value:function doRender(){var e=this.gauge;if(e&&this.chartTheme){this.rebuildPixels();var t=this.ctx,i=this.chartTheme,r=e.options||{},n=this.unit(),a=_slicedToArray(this.localCenter(),2),o=a[0],s=a[1],l=e.polar.radius,h=this.angles(),u=h.a0,c=h.sweep,d=this.range(),f=d.min,p=d.max,v=Math.max(2,Number(r.lineWidth)||14),m=this.renderedValue();this.beginDraw();for(var g=r.axisLineColor&&r.axisLineColor.length?r.axisLineColor:[[1,i.colorPalette[0]]],b=0,k=0;k<g.length;k++){var S=_slicedToArray(g[k],2),w=S[0],A=S[1],_=b,M=Math.max(b,Math.min(1,Number(w)));b=M,M<=_||(t.beginPath(),t.arc(o,s,l,u+_*c,u+M*c),t.strokeStyle=A,t.lineWidth=v,t.lineCap="butt",t.stroke())}var C=Math.max(1,Number(r.splitNumber)||5);this.setFont(.85*i.fontSize,i.fontFamily),t.fillStyle=i.subTextColor,t.textBaseline="middle",t.textAlign="center";for(var T=0;T<=C;T++){var P=T/C,I=u+P*c,O=l-v-2*n,N=l-v-8*n;t.beginPath(),t.moveTo(o+Math.cos(I)*O,s+Math.sin(I)*O),t.lineTo(o+Math.cos(I)*N,s+Math.sin(I)*N),t.strokeStyle=i.axisLineColor,t.lineWidth=n,t.stroke();var D=l-v-20*n;t.fillText(String(Math.round(f+P*(p-f))),o+Math.cos(I)*D,s+Math.sin(I)*D)}var H=r.pointer||{};if(!1!==H.show){var R=Math.max(.1,Number(H.length)||.72)*l,E=Math.max(1,Number(H.width)||5)*n,L=this.angleFor(m),z=o+Math.cos(L)*R,B=s+Math.sin(L)*R,W=o+Math.cos(L+Math.PI/2)*E,V=s+Math.sin(L+Math.PI/2)*E,j=o+Math.cos(L-Math.PI/2)*E,U=s+Math.sin(L-Math.PI/2)*E;t.beginPath(),t.moveTo(z,B),t.lineTo(W,V),t.lineTo(j,U),t.closePath(),t.fillStyle=i.textColor,t.fill(),t.beginPath(),t.arc(o,s,1.6*E,0,ae),t.fillStyle=i.textColor,t.fill(),t.beginPath(),t.arc(o,s,.7*E,0,ae),t.fillStyle="#ffffff",t.fill()}var X=r.detail||{},K=X.formatter?String(X.formatter(m)):"".concat(Math.round(100*m)/100),G=Math.max(0,360-this.angles().sweep/oe)>20;if(!1!==X.show){var Y=Number(X.fontSize)||Math.max(16,Math.round(.26*l));this.setFont(Y,i.fontFamily,"bold"),t.textAlign="center",t.textBaseline="middle",t.fillStyle=i.textColor,t.fillText(K,o,s+l*(G?.78:.42))}var q=r.title||{},$=this.series.points[0],Z=$&&($.name||void 0!==$.xValue)?$.name||String($.xValue):"";if(!1!==q.show&&Z){var J=Number(q.fontSize)||i.fontSize;this.setFont(J,i.fontFamily),measureTextWidth(t,Z,J,i.fontFamily),t.textAlign="center",t.textBaseline="middle",t.fillStyle=i.subTextColor,t.fillText(Z,o,s+l*(G?.6:.68))}this.endDraw()}}}])}(),le=function(){function BoxplotSeries(){var e;_classCallCheck(this,BoxplotSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,BoxplotSeries,[].concat(i)),"seriesType","boxplot"),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"boxCacheKey",""),e}return _inherits(BoxplotSeries,G),_createClass(BoxplotSeries,[{key:"boxWidthAt",value:function boxWidthAt(e){var t=Number(this.series.option.barWidth);return!isFinite(t)||t<=0?Math.max(4,.5*e):t<=1?Math.max(4,e*t):Math.max(4,t*this.unit())}},{key:"boxRectAt",value:function boxRectAt(e){var t=this.coord,i=this.series.points[e];if(!t||!i||!i.boxplot)return null;var r=t.xScale.map(i.xValue);if(!isFinite(r))return null;var n=t.xScale.bandwidth()||.5*t.xScale.step(),a=this.boxWidthAt(n),o=_slicedToArray(i.boxplot,4),s=o[1],l=o[3],h=_slicedToArray(i.boxplot,5),u=h[0],c=h[4],d=t.yScale.map(s),f=t.yScale.map(l),p=t.yScale.map(u),v=t.yScale.map(c);return isFinite(d)&&isFinite(f)&&isFinite(p)&&isFinite(v)?{x:r-a/2,y:Math.min(d,f),width:a,height:Math.max(Math.abs(f-d),this.unit())}:null}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord,t=this.series.points.length;if(e){var i=this.buildSeriesKey([t,e.plot.width,e.plot.height,String(e.xScale.domain.join(","))]);if(i!==this.boxCacheKey||this.pixels.length!==2*t){this.boxCacheKey=i,this.pixels.length!==2*t&&(this.pixels=new Float64Array(2*t));for(var r=0;r<t;r++){var n=this.boxRectAt(r),a=this.series.points[r];n&&a&&a.boxplot?(this.pixels[2*r]=n.x+n.width/2,this.pixels[2*r+1]=e.yScale.map(a.boxplot[2])):(this.pixels[2*r]=NaN,this.pixels[2*r+1]=NaN)}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var i=this.coord;if(!i)return-1;for(var r=0;r<this.series.points.length;r++){var n=this.series.points[r],a=this.boxRectAt(r);if(n&&n.boxplot&&a){var o=a.x+a.width/2;if(!(Math.abs(e-o)>a.width/2+1)){var s=i.yScale.map(n.boxplot[0]),l=i.yScale.map(n.boxplot[4]),h=Math.min(s,l),u=Math.max(s,l);if(t>=h-2&&t<=u+2)return r}}}return-1}},{key:"doRender",value:function doRender(){var e=this,t=this.coord;if(t&&this.chartTheme){this.rebuildPixels();var i=this.ctx;this.chartTheme;var r=this.unit(),n=this.pointColor(0),a=this.isEntering();this.computeItemProgress(),this.beginDraw();for(var o=function _loop(){var o=e.series.points[s],l=e.boxRectAt(s);if(!o||!o.boxplot||!l)return 0;var h=_slicedToArray(o.boxplot,5),u=h[0],c=h[1],d=h[2],f=h[3],p=h[4],v=l.x+l.width/2,m=t.yScale.map(d),g=a?e.itemProgress[s]:1;if(g<=0)return 0;var b=function lerp(e){return m+(e-m)*g},k=b(t.yScale.map(u)),S=b(t.yScale.map(p)),w=b(t.yScale.map(f)),A=b(t.yScale.map(c)),_={x:l.x,y:Math.min(w,A),width:l.width,height:Math.max(Math.abs(A-w),e.unit())};i.beginPath(),i.moveTo(v,S),i.lineTo(v,_.y),i.moveTo(v,_.y+_.height),i.lineTo(v,k),i.strokeStyle=n,i.lineWidth=r,i.stroke(),i.beginPath(),i.moveTo(v-l.width/4,S),i.lineTo(v+l.width/4,S),i.moveTo(v-l.width/4,k),i.lineTo(v+l.width/4,k),i.stroke(),i.beginPath(),i.rect(_.x,_.y,_.width,_.height),i.fillStyle=function hexWithAlpha(e,t){if(!e)return"rgba(0,0,0,".concat(t,")");var i=e.replace("#","");3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]);if(6!==i.length)return e;var r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return"rgba(".concat(r,",").concat(n,",").concat(a,",").concat(t,")")}(n,.28),i.fill(),i.strokeStyle=n,i.lineWidth=r,i.stroke(),i.beginPath(),i.moveTo(_.x,m),i.lineTo(_.x+_.width,m),i.lineWidth=Math.max(r,2*r),i.stroke(),e.drawHoverOverlay(s,_,{radius:1})},s=0;s<this.series.points.length;s++)o();this.endDraw()}}}])}();var he=function(){function WaterfallSeries(){var e;_classCallCheck(this,WaterfallSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,WaterfallSeries,[].concat(i)),"seriesType","waterfall"),e}return _inherits(WaterfallSeries,q),_createClass(WaterfallSeries,[{key:"isTotalItem",value:function isTotalItem(e){var t=this.series.points[e]&&this.series.points[e].raw;return!(!t||"object"!==_typeof(t)||Array.isArray(t)||!t.total)}},{key:"isIncrease",value:function isIncrease(e){var t=this.series.points[e];return!t||(t.y||0)>=0}},{key:"barColorAt",value:function barColorAt(e){var i=waterfallOptionOf(this.series),r=this.chartTheme,n=r&&r.colorPalette||t;return this.isTotalItem(e)?i.totalColor||n[0]:this.isIncrease(e)?i.increaseColor||n[1]:i.decreaseColor||n[2]}},{key:"doRender",value:function doRender(){if(_superPropGet(WaterfallSeries,"doRender",this,3)([]),!1!==waterfallOptionOf(this.series).connector){var e=this.coord;if(e){var t=this.ctx,i=this.unit(),r=this.chartTheme,n=e.yScale.isBand&&e.yScale.isBand();t.save(),t.strokeStyle=r&&r.subTextColor||"#6C757D",t.lineWidth=i,"function"==typeof t.setLineDash&&t.setLineDash([4*i,3*i]),t.beginPath();for(var a=0;a<this.series.points.length-1;a++){var o=this.barRectAt(a),s=this.barRectAt(a+1);if(o&&s)if(n){var l=Math.max(o.x+o.width,s.x+s.width),h=o.y+o.height/2,u=s.y+s.height/2;t.moveTo(l,h),t.lineTo(l,u)}else{var c=Math.min(o.y,s.y),d=o.x+o.width/2,f=s.x+s.width/2;t.moveTo(d,c),t.lineTo(f,c)}}t.stroke(),"function"==typeof t.setLineDash&&t.setLineDash([]),t.restore()}}}}])}();function waterfallOptionOf(e){return e&&e.waterfallOption?e.waterfallOption:e&&e.option&&e.option.waterfall||{}}var ue=function(){function TreemapSeries(){var e;_classCallCheck(this,TreemapSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,TreemapSeries,[].concat(i)),"seriesType","treemap"),_defineProperty(e,"treemap",null),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"treemapKey",""),_defineProperty(e,"morphFrom",{}),_defineProperty(e,"morphing",!1),_defineProperty(e,"rectCache",new Map),e}return _inherits(TreemapSeries,G),_createClass(TreemapSeries,[{key:"updateSeries",value:function updateSeries(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t&&this.treemap){var r,n={},a=_createForOfIteratorHelper(this.treemap.layout);try{for(a.s();!(r=a.n()).done;){var o=r.value;n["".concat(o.depth,":").concat(o.name)]=_objectSpread2({},o.rect)}}catch(e){a.e(e)}finally{a.f()}this.morphFrom=n,this.morphing=!0}return _superPropGet(TreemapSeries,"updateSeries",this,3)([e,t,i])}},{key:"rectOf",value:function rectOf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.rectCache,i=this.progress();if(!this.morphing)return e.rect;if(i>=1)return this.morphing=!1,e.rect;var r=t.get(e.id);if(r)return r;var n,a=this.treemap?this.treemap.layout:[],o=this.morphFrom["".concat(e.depth,":").concat(e.name)],s=e.parent>=0?a[e.parent]:null,l=s?this.morphFrom["".concat(s.depth,":").concat(s.name)]:null;if(s&&o&&l&&l.width>1&&l.height>1){var h=this.rectOf(s,t),u=(o.x-l.x)/l.width,c=(o.y-l.y)/l.height,d=o.width/l.width,f=o.height/l.height;n={x:h.x+u*h.width,y:h.y+c*h.height,width:d*h.width,height:f*h.height}}else n=o?{x:o.x+(e.rect.x-o.x)*i,y:o.y+(e.rect.y-o.y)*i,width:o.width+(e.rect.width-o.width)*i,height:o.height+(e.rect.height-o.height)*i}:e.rect;return t.set(e.id,n),n}},{key:"setCoord",value:function setCoord(e){return this.treemap=e||null,this.treemapKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 6}},{key:"highlightRectAt",value:function highlightRectAt(e){var t=this.treemap;if(!t)return null;var i=t.layout[e];if(!i)return null;var r=this.rectOf(i);return{x:r.x-t.plot.x,y:r.y-t.plot.y,width:r.width,height:r.height}}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.treemap,t=e&&e.layout||[];if(e&&t.length){var i=this.buildSeriesKey([t.length,e.plot.width,e.plot.height]);if(i!==this.treemapKey||this.pixels.length!==2*t.length){this.treemapKey=i,this.pixels=new Float64Array(2*t.length);var r,n=_createForOfIteratorHelper(t);try{for(n.s();!(r=n.n()).done;){var a=r.value,o=this.rectOf(a);this.pixels[2*a.id]=o.x-e.plot.x+o.width/2,this.pixels[2*a.id+1]=o.y-e.plot.y+o.height/2}}catch(e){n.e(e)}finally{n.f()}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.treemap;if(!i)return-1;var r,n=-1,a=-1,o=_createForOfIteratorHelper(i.layout);try{for(o.s();!(r=o.n()).done;){var s=r.value,l=this.rectOf(s),h=l.x-i.plot.x,u=l.y-i.plot.y;e<h||e>h+l.width||t<u||t>u+l.height||s.depth>a&&(a=s.depth,n=s.id)}}catch(e){o.e(e)}finally{o.f()}return n}},{key:"doRender",value:function doRender(){var e=this,t=this.treemap;if(t&&this.chartTheme){this.rebuildPixels();var i=this.ctx,r=this.chartTheme,n=this.unit(),a=t.plot,o=t.options||{},s=void 0===o.minLabelRatio?.02:Number(o.minLabelRatio);this.rectCache=new Map,this.beginDraw();var l,h=_createForOfIteratorHelper(t.layout);try{for(h.s();!(l=h.n()).done;){var u=l.value,c=this.rectOf(u),d=c.x-a.x,f=c.y-a.y;i.beginPath(),i.rect(d,f,c.width,c.height),i.fillStyle=u.color,i.fill(),0===u.depth&&(i.strokeStyle="rgba(255,255,255,0.9)",i.lineWidth=1.5*n,i.stroke())}}catch(e){h.e(e)}finally{h.f()}if(null!==this.hoverIndex){var p=t.layout[this.hoverIndex];if(p){var v=this.rectOf(p),m={x:v.x-a.x,y:v.y-a.y,width:v.width,height:p.hasChildren&&p.header>0?p.header:v.height};this.drawHoverOverlay(this.hoverIndex,m,{radius:0,fill:"rgba(255,255,255,0.18)"})}}var g=function fitFontSize(e,t){for(var n=r.fontSize;n>9&&!e.every(function(e){return measureTextWidth(i,e,n,r.fontFamily)<=t});)n-=1;return n};this.setFont(r.fontSize,r.fontFamily),i.textAlign="center",i.textBaseline="middle";var b,k=_createForOfIteratorHelper(t.layout);try{var S=function _loop(){var t=b.value;if(t.ratio<s)return 0;var o=e.rectOf(t),l="".concat((100*t.ratio).toFixed(1),"%");if(t.hasChildren&&t.header>0){i.textAlign="left",i.fillStyle=0===t.depth?"#ffffff":r.textColor;var h="".concat(t.name," ").concat(l),u=g([h],o.width-16*n);return(u>9||measureTextWidth(i,h,u,r.fontFamily)<=o.width-16*n)&&(e.setFont(u,r.fontFamily,"bold"),i.fillText(h,o.x-a.x+8*n,o.y-a.y+t.header/2)),0}if(o.width<44||o.height<26)return 0;var c=(o.height>=40?"".concat(t.name,"\n").concat(l):"".concat(t.name," ").concat(l)).split("\n"),d=g(c,o.width-8*n);if(Math.max.apply(Math,_toConsumableArray(c.map(function(e){return measureTextWidth(i,e,d,r.fontFamily)})))>o.width-8*n)return 0;e.setFont(d,r.fontFamily),i.textAlign="center";var f=0===t.depth?"#ffffff":r.textColor;i.fillStyle=f;for(var p=1.35*d,v=o.y-a.y+o.height/2-(c.length-1)*p/2,m=0;m<c.length;m++)i.fillText(c[m],o.x-a.x+o.width/2,v+m*p)};for(k.s();!(b=k.n()).done;)S()}catch(e){k.e(e)}finally{k.f()}this.endDraw()}}}])}();function forceLayout(e,i,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{nodes:[],links:[]},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t,o=e.length;if(!o)return{nodes:[],links:[]};var s,l=n.layout||"force",h=_slicedToArray(Array.isArray(n.symbolSizeRange)?n.symbolSizeRange:[12,48],2),u=h[0],c=h[1],d=function indexOf(t){if("number"==typeof t)return t>=0&&t<o?t:-1;for(var i=0;i<o;i++){var r=e[i];if(r.id===t||r.name===t)return i}return-1},f=i.map(function(e,t){return{id:t,source:d(e.source),target:d(e.target),value:Number(e.value)||1,color:e.color}}).filter(function(e){return e.source>=0&&e.target>=0&&e.source!==e.target}),p=r.x+r.width/2,v=r.y+r.height/2,m=Math.max(10,Math.min(r.width,r.height)/2-c/2-4),g=e.map(function(e,t){if(isFinite(Number(e.x))&&isFinite(Number(e.y)))return{x:clamp(Number(e.x),r.x+2,r.x+r.width-2),y:clamp(Number(e.y),r.y+2,r.y+r.height-2)};var i=t/o*Math.PI*2-Math.PI/2;return{x:p+Math.cos(i)*m*.8,y:v+Math.sin(i)*m*.8}}),b=g.map(function(){return{x:0,y:0}}),k=g.map(function(e){return{x:e.x,y:e.y}}),S=new Array(o).fill(0),w=new Array(o).fill(0),A=_createForOfIteratorHelper(f);try{for(A.s();!(s=A.n()).done;){var _=s.value;S[_.source]++,S[_.target]++,w[_.source]+=_.value,w[_.target]+=_.value}}catch(e){A.e(e)}finally{A.f()}var M=Math.max.apply(Math,[1].concat(_toConsumableArray(w))),C=function sizeOf(t){var i=Number(e[t].value);if(!isFinite(i)||i<=0)return u;var r=Math.sqrt(Math.max(0,Math.min(1,w[t]/M)));return u+(c-u)*r};if("force"===l)for(var T=numberOr(n.repulsion,6e3),P=numberOr(n.edgeLength,70),I=numberOr(n.gravity,.06),O=Math.max(.1,Math.min(.98,numberOr(n.damping,.85))),N=Math.max(1,Math.floor(numberOr(n.iterations,240))),D=Math.max(8,(u+c)/6),H=0;H<N;H++){for(var R=1-H/N,E=0;E<o;E++)if(!e[E].fixed)for(var L=E+1;L<o;L++){var z=g[L].x-g[E].x,B=g[L].y-g[E].y,W=Math.hypot(z,B);W<D&&(z=z||(E%2==0?.5:-.5),B=B||(L%2==0?.5:-.5),W=Math.hypot(z,B));var V=T/(W*W)*R,j=z/W*V,U=B/W*V;b[E].x-=j,b[E].y-=U,e[L].fixed||(b[L].x+=j,b[L].y+=U)}var X,K=_createForOfIteratorHelper(f);try{for(K.s();!(X=K.n()).done;){var G=X.value,Y=g[G.source],q=g[G.target],$=q.x-Y.x,Z=q.y-Y.y,J=Math.max(.01,Math.hypot($,Z)),Q=.06*(J-(P+(G.value>1?Math.min(40,G.value):0)))*R,ee=$/J*Q,te=Z/J*Q;e[G.source].fixed||(b[G.source].x+=ee,b[G.source].y+=te),e[G.target].fixed||(b[G.target].x-=ee,b[G.target].y-=te)}}catch(e){K.e(e)}finally{K.f()}for(var ie=0;ie<o;ie++)e[ie].fixed||(b[ie].x+=(p-g[ie].x)*I*R,b[ie].y+=(v-g[ie].y)*I*R,b[ie].x*=O,b[ie].y*=O,g[ie].x+=b[ie].x,g[ie].y+=b[ie].y)}if("force"===l&&o>1){for(var re=1/0,ne=1/0,ae=-1/0,oe=-1/0,se=0;se<o;se++){var le=C(se)/2;re=Math.min(re,g[se].x-le),ae=Math.max(ae,g[se].x+le),ne=Math.min(ne,g[se].y-le),oe=Math.max(oe,g[se].y+le)}var he=Math.max(1,ae-re),ue=Math.max(1,oe-ne),ce=Math.min(3,Math.min((r.width-16)/he,(r.height-16)/ue));if(isFinite(ce)&&ce>0)for(var de=(re+ae)/2,fe=(ne+oe)/2,pe=0;pe<o;pe++)g[pe].x=p+(g[pe].x-de)*ce,g[pe].y=v+(g[pe].y-fe)*ce}var ve=e.map(function(e,t){var i=C(t)/2,o=clamp(g[t].x,r.x+i,r.x+r.width-i),s=clamp(g[t].y,r.y+i,r.y+r.height-i);return{id:t,name:e.name,x:o,y:s,initialX:k[t].x,initialY:k[t].y,size:C(t),value:w[t],degree:S[t],color:e.color||colorOf(e,n,a,t),category:e.category,fixed:!!e.fixed}}),ye=Math.max.apply(Math,[1].concat(_toConsumableArray(f.map(function(e){return e.value})))),me=f.map(function(e){return{id:e.id,source:e.source,target:e.target,value:e.value,width:1+3*Math.sqrt(e.value/ye),color:e.color||ve[e.source].color}});return{nodes:ve,links:me}}function colorOf(e,t,i,r){if(void 0!==e.category&&Array.isArray(t.categories)){var n=t.categories.find(function(t){return t.name===e.category});if(n&&n.color)return n.color;var a=t.categories.findIndex(function(t){return t.name===e.category});if(a>=0)return i[a%i.length]}return i[r%i.length]}function numberOr(e,t){var i=Number(e);return isFinite(i)?i:t}function clamp(e,t,i){return e<t?t:e>i?i:e}function sampleGraphLink(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:14,n=t[e.source],a=t[e.target],o=[];if(!n||!a)return o;if(!i)return o.push([n.x,n.y],[a.x,a.y]),o;for(var s=(n.x+a.x)/2,l=(n.y+a.y)/2,h=a.x-n.x,u=a.y-n.y,c=Math.max(1,Math.hypot(h,u)),d=Math.min(30,.18*c),f=s-u/c*d,p=l+h/c*d,v=0;v<=r;v++){var m=v/r,g=1-m;o.push([g*g*n.x+2*g*m*f+m*m*a.x,g*g*n.y+2*g*m*p+m*m*a.y])}return o}var ce=function(){function GraphSeries(){var e;_classCallCheck(this,GraphSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,GraphSeries,[].concat(i)),"seriesType","graph"),_defineProperty(e,"graph",null),_defineProperty(e,"clipToBox",!1),_defineProperty(e,"graphKey",""),e}return _inherits(GraphSeries,G),_createClass(GraphSeries,[{key:"setCoord",value:function setCoord(e){return this.graph=e||null,this.graphKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 28}},{key:"nodeCount",get:function get(){return this.graph&&this.graph.layout.nodes.length||0}},{key:"moveNode",value:function moveNode(e,t,i){var r=this.graph;if(!r)return!1;var n=r.layout.nodes[e];if(!n)return!1;var a=r.plot,o=n.size/2;return n.x=Math.max(a.x+o,Math.min(a.x+a.width-o,t+a.x)),n.y=Math.max(a.y+o,Math.min(a.y+a.height-o,i+a.y)),n.fixed=!0,this.graphKey="",this.markDirty(),!0}},{key:"settle",value:function settle(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,t=this.graph;if(t){var i=t.options||{},r=forceLayout(t.layout.nodes.map(function(e,t){return _objectSpread2(_objectSpread2({},i.nodes&&i.nodes[t]||{name:e.name}),{},{x:e.x,y:e.y,fixed:e.fixed})}),i.links||[],t.plot,_objectSpread2(_objectSpread2({},i),{},{layout:"force",iterations:e}),this.chartTheme?this.chartTheme.colorPalette:void 0);t.layout=r,this.graphKey="",this.markDirty()}}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.graph;if(e){var t=e.layout,i=t.nodes,r=t.links,n=i.length+r.length,a=this.buildSeriesKey([n,e.plot.width,e.plot.height,i.length,r.length]);if(a!==this.graphKey||this.pixels.length!==2*n){this.graphKey=a,this.pixels.length!==2*n&&(this.pixels=new Float64Array(2*n));var o,s=_createForOfIteratorHelper(i);try{for(s.s();!(o=s.n()).done;){var l=o.value;this.pixels[2*l.id]=l.x-e.plot.x,this.pixels[2*l.id+1]=l.y-e.plot.y}}catch(e){s.e(e)}finally{s.f()}var h,u=_createForOfIteratorHelper(r);try{for(u.s();!(h=u.n()).done;){var c=h.value,d=sampleGraphLink(c,i,!1!==e.options.curve,4),f=d[Math.floor(d.length/2)]||[0,0],p=i.length+c.id;this.pixels[2*p]=f[0]-e.plot.x,this.pixels[2*p+1]=f[1]-e.plot.y}}catch(e){u.e(e)}finally{u.f()}this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.graph;if(!i)return-1;var r,n=i.layout,a=n.nodes,o=n.links,s=i.plot,l=_createForOfIteratorHelper(a);try{for(l.s();!(r=l.n()).done;){var h=r.value,u=e-(h.x-s.x),c=t-(h.y-s.y),d=h.size/2*this.hoverBoost(h.id,.28)+3;if(u*u+c*c<=d*d)return h.id}}catch(e){l.e(e)}finally{l.f()}var f,p=!1!==i.options.curve,v=_createForOfIteratorHelper(o);try{for(v.s();!(f=v.n()).done;)for(var m=f.value,g=sampleGraphLink(m,a,p,12),b=1;b<g.length;b++){if(distanceToSegment(e,t,g[b-1][0]-s.x,g[b-1][1]-s.y,g[b][0]-s.x,g[b][1]-s.y)<=6)return a.length+m.id}}catch(e){v.e(e)}finally{v.f()}return-1}},{key:"doRender",value:function doRender(){var e=this.graph;if(e&&this.chartTheme){this.rebuildPixels();var t=this.ctx,i=this.chartTheme,r=e.plot,n=this.unit(),a=e.layout,o=a.nodes,s=a.links,l=!1!==e.options.curve,h=this.isEntering(),u=h?Math.max(0,Math.min(1,this.progress())):1,c=function positionOf(e){return h?[e.initialX+(e.x-e.initialX)*u,e.initialY+(e.y-e.initialY)*u]:[e.x,e.y]},d=o.map(function(e){var t=_slicedToArray(c(e),2),i=t[0],r=t[1];return _objectSpread2(_objectSpread2({},e),{},{x:i,y:r})});this.beginDraw(),t.globalAlpha=.55;var f,p=_createForOfIteratorHelper(s);try{for(p.s();!(f=p.n()).done;){var v=f.value,m=sampleGraphLink(v,d,l,16);if(!(m.length<2)){t.beginPath(),t.moveTo(m[0][0]-r.x,m[0][1]-r.y);for(var g=1;g<m.length;g++)t.lineTo(m[g][0]-r.x,m[g][1]-r.y);t.strokeStyle=v.color,t.lineWidth=Math.max(n,v.width*n),t.stroke()}}}catch(e){p.e(e)}finally{p.f()}t.globalAlpha=1;var b,k=_createForOfIteratorHelper(o);try{for(k.s();!(b=k.n()).done;){var S=b.value,w=_slicedToArray(c(S),2),A=w[0],_=w[1],M=A-r.x,C=_-r.y,T=Math.max(2,S.size/2*this.hoverBoost(S.id,.28));t.beginPath(),t.arc(M,C,T,0,2*Math.PI),t.fillStyle=S.color,t.fill(),t.strokeStyle="rgba(255,255,255,0.85)",t.lineWidth=n*(this.hoverBoost(S.id,.28)>1?2:1),t.stroke()}}catch(e){k.e(e)}finally{k.f()}this.setFont(i.fontSize,i.fontFamily),t.textAlign="center",t.textBaseline="middle",t.fillStyle=i.textColor;var P,I=_createForOfIteratorHelper(o);try{for(I.s();!(P=I.n()).done;){var O=P.value,N=_slicedToArray(c(O),2),D=N[0],H=N[1],R=D-r.x,E=H-r.y+O.size/2+9*n;t.strokeStyle=i.labelHaloColor,t.lineWidth=3*n,t.strokeText(O.name,R,E),t.fillText(O.name,R,E)}}catch(e){I.e(e)}finally{I.f()}this.endDraw()}}},{key:"nodeSizeAt",value:function nodeSizeAt(e){var t=this.graph,i=t&&t.layout.nodes[e];return i?i.size*this.hoverBoost(e,.28):10}}])}(),de=function(){function CurveSeriesBase(){var e;_classCallCheck(this,CurveSeriesBase);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,CurveSeriesBase,[].concat(i)),"curve",[]),_defineProperty(e,"curveKey",""),_defineProperty(e,"clipToBox",!0),_defineProperty(e,"supportsSampling",!1),_defineProperty(e,"monotonicX",!0),e}return _inherits(CurveSeriesBase,G),_createClass(CurveSeriesBase,[{key:"resolvedParams",value:function resolvedParams(){var e=_objectSpread2({},this.series.option.params||{}),t=this.series.option.sweep;if(t&&t.name){var i=Number(t.from),r=Number(t.to),n=shouldAnimate()?this.sweepPhase():0;e[t.name]=i+(r-i)*n}return e}},{key:"sweepPhase",value:function sweepPhase(){var e=this.series.option.sweep;if(!e)return 0;var t=Math.max(200,Number(e.duration)||3e3),i=(Date.now()%t+t)%t/t;return"loop"===e.mode?i:1-Math.abs(2*i-1)}},{key:"paramValue",value:function paramValue(e){var t=this.resolvedParams();return"number"==typeof t[e]?t[e]:null}},{key:"syncSweep",value:function syncSweep(){var e=this.series.option.sweep;!!(e&&e.name&&shouldAnimate()&&!1!==this.state.display)?this.keepAnimating():this.stopAnimating()}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.coord;if(!e)return this.pixels=new Float64Array(0),void(this.curve=[]);this.syncSweep();var t=this.resolvedParams(),i=e.plot,r=_slicedToArray(this.parameterRange(i),2),n=r[0],a=r[1],o=this.buildSeriesKey([this.paramKey(t),i.width,i.height,Number(n).toPrecision(12),Number(a).toPrecision(12)]);if(o!==this.curveKey){this.curveKey=o;var s=this.series.points,l=s.length;this.pixels.length!==2*l&&(this.pixels=new Float64Array(2*l));for(var h=0;h<l;h++){var u=_slicedToArray(this.evaluateAt(Number(s[h].xValue),t),2),c=u[0],d=u[1],f=isFinite(c)?e.xScale.map(c):NaN,p=isFinite(d)?e.yScale.map(d):NaN;this.pixels[2*h]=f,this.pixels[2*h+1]=p}for(var v=this.sampleCurve(t,i),m=new Array(2*v.length),g=0;g<v.length;g++){var b=_slicedToArray(v[g],2),k=b[0],S=b[1];m[2*g]=isFinite(k)?e.xScale.map(k):NaN,m[2*g+1]=isFinite(S)?e.yScale.map(S):NaN}this.curve=m,this.xMonotonic=this.monotonicX,this.computeEffective(),this.renderIndices=null}}},{key:"paramKey",value:function paramKey(e){return Object.keys(e).sort().map(function(t){return"".concat(t,"=").concat(Number(e[t]).toPrecision(10))}).join(",")}},{key:"sampleCount",value:function sampleCount(){return this.rebuildPixels(),this.curve.length/2}},{key:"hitTestIndex",value:function hitTestIndex(e,t){this.rebuildPixels();var i=this.pixels.length/2;if(!i)return-1;for(var r=this.series.option,n=Math.max(6,this.lineWidthDevice()+4)+(isFinite(Number(r.hitRadius))?Number(r.hitRadius):0),a=-1,o=n*n,s=0;s<i;s++){var l=this.pixels[2*s]-e,h=this.pixels[2*s+1]-t;if(isFinite(l)&&isFinite(h)){var u=l*l+h*h;u<=o&&(o=u,a=s)}}return a}},{key:"hoverLineScale",value:function hoverLineScale(){return null===this.hoverIndex?1:1+.45*this.highlightT()}},{key:"doRender",value:function doRender(){if(this.rebuildPixels(),this.curve.length){var e=this.ctx,t=this.unit(),i=this.pointColor(0),r=this.series.option;this.beginDraw(),e.strokeStyle=i,e.lineWidth=this.lineWidthDevice()*t*this.hoverLineScale(),"function"==typeof e.setLineDash&&Array.isArray(r.lineDash)&&e.setLineDash(r.lineDash.map(function(e){return e*t})),e.beginPath();for(var n=this.isEntering()?Math.max(.001,Math.min(1,this.progress())):1,a=this.curve.length/2,o=Math.max(1,Math.ceil(a*n)),s=!1,l=0;l<o;l++){var h=this.curve[2*l],u=this.curve[2*l+1];isFinite(h)&&isFinite(u)?s?e.lineTo(h,u):(e.moveTo(h,u),s=!0):s=!1}e.stroke(),"function"==typeof e.setLineDash&&e.setLineDash([]),this.endDraw()}}},{key:"curvePoints",value:function curvePoints(){return this.rebuildPixels(),this.curve}}])}(),fe=function(){function FunctionSeries(){var e;_classCallCheck(this,FunctionSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,FunctionSeries,[].concat(i)),"seriesType","function"),_defineProperty(e,"cachedSource",""),_defineProperty(e,"sampler",null),e}return _inherits(FunctionSeries,de),_createClass(FunctionSeries,[{key:"samplerFor",value:function samplerFor(e){var t=String(this.series.option.expression||"");if(t!==this.cachedSource||!this.sampler){this.cachedSource=t;try{this.sampler=compileSampler(t)}catch(e){this.sampler={setParams:function setParams(){},evaluate:function evaluate(){return NaN}}}}var i=this.sampler;return i.setParams(e),function(e){return i.evaluate("x",e)}}},{key:"evaluateAt",value:function evaluateAt(e,t){return[e,this.samplerFor(t)(e)]}},{key:"parameterRange",value:function parameterRange(e){var t=this.coord,i=t&&t.xScale&&t.xScale.domain;if(i&&i.length>=2){var r=Number(i[0]),n=Number(i[i.length-1]);if(isFinite(r)&&isFinite(n)&&n>r)return[r,n]}var a=this.series.option.domain;return[a?Number(a[0]):-10,a?Number(a[1]):10]}},{key:"baseSampleCount",value:function baseSampleCount(){var e=Number(this.series.option.samples);return Math.max(24,Math.min(4e3,isFinite(e)&&e>0?e:240))}},{key:"sampleCurve",value:function sampleCurve(e,t){var i=this.samplerFor(e),r=_slicedToArray(this.parameterRange(t),2);return sampleFunctionCurve(i,r[0],r[1],{base:this.baseSampleCount(),adaptive:!1!==this.series.option.adaptive,tolerance:this.series.option.samplingTolerance})}}])}(),pe=function(){function ParametricSeries(){var e;_classCallCheck(this,ParametricSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,ParametricSeries,[].concat(i)),"seriesType","parametric"),_defineProperty(e,"cachedSources",""),_defineProperty(e,"samplerX",null),_defineProperty(e,"samplerY",null),_defineProperty(e,"samplerR",null),e.monotonicX=!1,e}return _inherits(ParametricSeries,de),_createClass(ParametricSeries,[{key:"samplersFor",value:function samplersFor(e){var t=this.series.option,i=void 0===t.polarExpression||null===t.polarExpression?"":String(t.polarExpression);if(i){var r="polar\0".concat(i,"\0").concat(Object.keys(e).sort().join(","));if(r!==this.cachedSources||!this.samplerR){this.cachedSources=r;try{this.samplerR=compileSampler(i)}catch(e){this.samplerR={setParams:function setParams(){},evaluate:function evaluate(){return NaN}}}}var n=this.samplerR;return n.setParams(e),{x:function x(e){return n.evaluate("t",e)*Math.cos(e)},y:function y(e){return n.evaluate("t",e)*Math.sin(e)}}}var a=String(t.xExpression||""),o=String(t.yExpression||""),s="".concat(a,"\0").concat(o,"\0").concat(Object.keys(e).sort().join(","));if(s!==this.cachedSources||!this.samplerX||!this.samplerY){this.cachedSources=s;var l={setParams:function setParams(){},evaluate:function evaluate(){return NaN}};try{this.samplerX=compileSampler(a)}catch(e){this.samplerX=l}try{this.samplerY=compileSampler(o)}catch(e){this.samplerY=l}}var h=this.samplerX,u=this.samplerY;return h.setParams(e),u.setParams(e),{x:function x(e){return h.evaluate("t",e)},y:function y(e){return u.evaluate("t",e)}}}},{key:"evaluateAt",value:function evaluateAt(e,t){var i=this.samplersFor(t),r=i.x,n=i.y;return[r(e),n(e)]}},{key:"parameterRange",value:function parameterRange(e){var t=this.series.option.domain,i=t?Number(t[0]):0,r=t?Number(t[1]):2*Math.PI;return isFinite(i)&&isFinite(r)&&r!==i?[i,r]:[0,2*Math.PI]}},{key:"baseSampleCount",value:function baseSampleCount(){var e=Number(this.series.option.samples);return Math.max(24,Math.min(6e3,isFinite(e)&&e>0?e:360))}},{key:"sampleCurve",value:function sampleCurve(e,t){var i=this.samplersFor(e),r=i.x,n=i.y,a=_slicedToArray(this.parameterRange(t),2);return sampleParametricCurve(r,n,a[0],a[1],{base:this.baseSampleCount(),adaptive:!1!==this.series.option.adaptive,tolerance:this.series.option.samplingTolerance})}}])}(),ve=2*Math.PI,ye=function(){function LiquidSeries(){var e;_classCallCheck(this,LiquidSeries);for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return _defineProperty(e=_callSuper(this,LiquidSeries,[].concat(i)),"seriesType","liquid"),_defineProperty(e,"liquid",null),_defineProperty(e,"liquidKey",""),_defineProperty(e,"fromRatio",null),e}return _inherits(LiquidSeries,G),_createClass(LiquidSeries,[{key:"setCoord",value:function setCoord(e){return this.liquid=e||null,this.liquidKey="",this.markDirty()}},{key:"paintPad",value:function paintPad(){return 6}},{key:"localCenter",value:function localCenter(){var e=this.liquid;return[e.polar.cx-e.plot.x,e.polar.cy-e.plot.y]}},{key:"range",value:function range(){var e=this.liquid&&this.liquid.options||{},t=isFinite(Number(e.min))?Number(e.min):0,i=isFinite(Number(e.max))?Number(e.max):100;return{min:t,max:i>t?i:t+1}}},{key:"targetRatio",value:function targetRatio(){var e=this.range(),t=e.min,i=e.max,r=this.series.points.length&&Number(this.series.points[0].y)||0;return Math.max(0,Math.min(1,(r-t)/(i-t)))}},{key:"currentRatio",value:function currentRatio(){var e=this.targetRatio(),t=Math.max(0,Math.min(1,this.progress())),i=null===this.fromRatio?0:this.fromRatio;return i+(e-i)*t}},{key:"levelRatio",value:function levelRatio(){return this.currentRatio()}},{key:"updateSeries",value:function updateSeries(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t&&this.liquid&&(this.fromRatio=this.currentRatio()),_superPropGet(LiquidSeries,"updateSeries",this,3)([e,t,i])}},{key:"phase",value:function phase(){var e=this.liquid&&this.liquid.options||{};if(!shouldAnimate())return 0;var t=isFinite(Number(e.waveSpeed))?Number(e.waveSpeed):1.6;return Date.now()/1e3*t}},{key:"syncWave",value:function syncWave(){var e=this.targetRatio();shouldAnimate()&&e>.001&&e<.999&&!1!==this.state.display?this.keepAnimating():this.stopAnimating()}},{key:"rebuildPixels",value:function rebuildPixels(){var e=this.liquid;if(e){var t=this.series.points.length&&Number(this.series.points[0].y)||0,i=this.buildSeriesKey([e.polar.radius,e.options.min,e.options.max,t]);if(i!==this.liquidKey||2!==this.pixels.length){this.liquidKey=i,2!==this.pixels.length&&(this.pixels=new Float64Array(2));var r=_slicedToArray(this.localCenter(),2),n=r[0],a=r[1];this.pixels[0]=n,this.pixels[1]=a,this.xMonotonic=!1,this.renderIndices=null}}else this.pixels=new Float64Array(0)}},{key:"hitTestIndex",value:function hitTestIndex(e,t){var i=this.liquid;if(!i||!this.series.points.length)return-1;var r=_slicedToArray(this.localCenter(),2),n=r[0],a=r[1];return Math.hypot(e-n,t-a)<=i.polar.radius+8?0:-1}},{key:"wavePath",value:function wavePath(e,t,i,r,n,a,o,s){var l=Math.max(1,2*r/64);e.beginPath(),e.moveTo(t-r,n+a*Math.sin(s));for(var h=-r+l;h<=r;h+=l)e.lineTo(t+h,n+a*Math.sin(h/o*ve+s))}},{key:"doRender",value:function doRender(){var e=this.liquid;if(e&&this.chartTheme){this.rebuildPixels(),this.syncWave();var t=this.ctx,i=this.chartTheme,r=e.options||{},n=this.unit(),a=_slicedToArray(this.localCenter(),2),o=a[0],s=a[1],l=e.polar.radius,h=Math.max(1,Number(r.borderWidth)||3)*n,u=Math.max(2,l-h),c=r.color||this.pointColor(0),d=this.currentRatio(),f=isFinite(Number(r.waveHeight))?Number(r.waveHeight):.06,p=Math.max(.15,isFinite(Number(r.waveLength))?Number(r.waveLength):1.2)*u,v=f*u,m=this.phase();this.beginDraw(),t.beginPath(),t.arc(o,s,u,0,ve),t.fillStyle=hexToRgba(c,.1),t.fill(),t.save(),t.beginPath(),t.arc(o,s,u,0,ve),t.clip();for(var g=s+u-2*u*d,b=0,k=[{phase:m,alpha:.34,ampScale:1.25},{phase:m+.6*Math.PI,alpha:.55,ampScale:1}];b<k.length;b++){var S=k[b];this.wavePath(t,o,s,u,g,v*S.ampScale,p,S.phase),t.lineTo(o+u,s+u+2*v),t.lineTo(o-u,s+u+2*v),t.closePath(),t.globalAlpha=S.alpha;var w=t.createLinearGradient?t.createLinearGradient(0,g-v,0,s+u):null;w?(w.addColorStop(0,hexToRgba(c,.95)),w.addColorStop(1,hexToRgba(c,.55)),t.fillStyle=w):t.fillStyle=c,t.fill(),t.globalAlpha=1}t.restore(),t.beginPath(),t.arc(o,s,l-h/2,0,ve),t.strokeStyle=r.borderColor||hexToRgba(c,.6),t.lineWidth=h,t.stroke();var A=r.detail||{};if(!1!==A.show){var _=this.range().min,M=_+((this.series.points.length&&Number(this.series.points[0].y)||0)-_)*Math.max(0,Math.min(1,this.progress())),C="function"==typeof A.formatter?A.formatter(M):"".concat(Number(M.toPrecision(4))).concat(void 0===r.unit?"%":r.unit),T=this.series.points.length?this.series.points[0].name:void 0;T&&!1!==r.title&&(this.setFont(i.fontSize,i.fontFamily),t.fillStyle=i.subTextColor,t.textAlign="center",t.textBaseline="middle",t.fillText(String(T),o,s-.9*(Number(A.fontSize)||.28*l)*n));var P=isFinite(Number(A.fontSize))?Number(A.fontSize):Math.max(14,.42*l);this.setFont(P*n,i.fontFamily,"bold"),t.fillStyle=r.textColor||i.textColor,t.textAlign="center",t.textBaseline="middle",t.fillText(C,o,s+(T?.18*P*n:0))}this.endDraw()}}}])}(),me={bar:function bar(e,t){return new q(e,t)},area:function area(e,t){return new $(e,t)},line:function line(e,t){return new Y(e,t)},scatter:function scatter(e,t){return new Z(e,t)},pie:function pie(e,t){return new Q(e,t)},radar:function radar(e,t){return new ee(e,t)},candlestick:function candlestick(e,t){return new te(e,t)},heatmap:function heatmap(e,t){return new ie(e,t)},sankey:function sankey(e,t){return new re(e,t)},funnel:function funnel(e,t){return new ne(e,t)},gauge:function gauge(e,t){return new se(e,t)},boxplot:function boxplot(e,t){return new le(e,t)},waterfall:function waterfall(e,t){return new he(e,t)},treemap:function treemap(e,t){return new ue(e,t)},graph:function graph(e,t){return new ce(e,t)},function:function _function(e,t){return new fe(e,t)},parametric:function parametric(e,t){return new pe(e,t)},liquid:function liquid(e,t){return new ye(e,t)}},xe={},ge=/^[a-zA-Z][\w-]*$/;function getSeriesTypeFactory(e){return Object.prototype.hasOwnProperty.call(me,e)?me[e]:xe[e]||null}function createSeriesComponent(e,t){return(getSeriesTypeFactory(String(e.type))||me.line)(e,t)}var be=function(){return _createClass(function HitResolver(e){_classCallCheck(this,HitResolver),this.host=e},[{key:"resolveTarget",value:function resolveTarget(e,t){var i=this.host.ice,r={kind:"none",component:null,index:-1,local:[0,0],chart:[0,0]};if(!i||"function"!=typeof i.hitTest)return r;var n=_slicedToArray(i.screenToWorld(e,t),2),a=n[0],o=n[1],s=[a,o],l=i.hitTest(e,t);if(!l)return _objectSpread2(_objectSpread2({},r),{},{chart:s});var h=l.globalToLocal?l.globalToLocal(a,o):[0,0];if(l===this.host.plotArea)return{kind:"plot",component:l,index:-1,local:h,chart:s};if(l===this.host.legend)return{kind:"legend",component:l,index:this.host.legend&&"function"==typeof this.host.legend.hitItem?this.host.legend.hitItem(h[0],h[1]):-1,local:h,chart:s};if("function"==typeof l.hitTestIndex){var u=l.hitTestIndex(h[0],h[1]);return{kind:u>=0?"series":"other",component:l,index:u,local:h,chart:s}}return{kind:"other",component:l,index:-1,local:h,chart:s}}},{key:"isInsidePlot",value:function isInsidePlot(e,t){var i=this.host.layout.plot;return e>=i.x&&e<=i.x+i.width&&t>=i.y&&t<=i.y+i.height}},{key:"seriesComponentOf",value:function seriesComponentOf(e){if(!e)return null;var t,i=_createForOfIteratorHelper(this.host.seriesComponents);try{for(i.s();!(t=i.n()).done;){var r=t.value;if(r.series===e)return r}}catch(e){i.e(e)}finally{i.f()}var n=e.id;if(null!=n){var a,o=_createForOfIteratorHelper(this.host.seriesComponents);try{for(o.s();!(a=o.n()).done;){var s=a.value;if(s.series&&s.series.id===n)return s}}catch(e){o.e(e)}finally{o.f()}}return null}},{key:"seriesOfComponent",value:function seriesOfComponent(e){var t,i=_createForOfIteratorHelper(this.host.norm.series);try{for(i.s();!(t=i.n()).done;){var r=t.value;if(this.seriesComponentOf(r)===e)return r}}catch(e){i.e(e)}finally{i.f()}return null}},{key:"buildActiveItem",value:function buildActiveItem(e,t){var i=this.seriesComponentOf(e);if(!i)return null;var r=i.pixelAt(t),n=e.points[t];if(!r||!n)return null;var a=this.host.layout.plot;return{series:e,point:n,pixel:[a.x+r[0],a.y+r[1]],screen:[0,0]}}},{key:"toParams",value:function toParams(e){var t=this.host.ice,i=t&&"function"==typeof t.worldToScreen?t.worldToScreen(e.pixel[0],e.pixel[1]):e.pixel;return{seriesId:e.series.id,seriesName:e.series.name,seriesIndex:e.series.index,seriesType:e.series.type,color:e.series.color,dataIndex:e.point.index,data:e.point.raw,xValue:e.point.xValue,value:e.point.y,screen:[i[0],i[1]]}}},{key:"pickColumn",value:function pickColumn(e){var t=e-this.host.layout.plot.x,i=this.host.norm.series.filter(function(e){return!e.hidden});if(!i.length)return null;var r,n=[],a=null,o=_createForOfIteratorHelper(i);try{for(o.s();!(r=o.n()).done;){var s=r.value,l=this.seriesComponentOf(s);if(l){var h=this.nearestIndexByX(l,t);if(!(h<0)){var u=this.buildActiveItem(s,h);u&&(n.push(u),null===a&&(a=s.points[h].xValue))}}}}catch(e){o.e(e)}finally{o.f()}return n.length?{dataIndex:n[0].point.index,xValue:a,pixelX:n[0].pixel[0],items:n}:null}},{key:"nearestIndexByX",value:function nearestIndexByX(e,t){return e.nearestIndexAtX(t)}},{key:"nearestByXValue",value:function nearestByXValue(e){var t,i=this.host.norm.series.filter(function(e){return!e.hidden}),r=this.host.norm.hiddenSlices||{},n=null,a=_createForOfIteratorHelper(i);try{for(a.s();!(t=a.n()).done;)for(var o=t.value,s=0;s<o.points.length;s++)if("pie"!==o.type&&"funnel"!==o.type||!r["".concat(o.id,"#").concat(s)]){var l=valueDistance(e,o.points[s].xValue);null!==l&&(!n||l<n.dist)&&(n={series:o,index:s,dist:l})}}catch(e){a.e(e)}finally{a.f()}return n?this.buildActiveItem(n.series,n.index):null}}])}();function valueDistance(e,t){var i=e instanceof Date?e.getTime():Number(e),r=t instanceof Date?t.getTime():Number(t);return isFinite(i)&&isFinite(r)?Math.abs(i-r):String(e)===String(t)?0:null}var ke=null,Se=function(){return _createClass(function InteractionController(e){_classCallCheck(this,InteractionController),_defineProperty(this,"hover",null),_defineProperty(this,"selection",[]),_defineProperty(this,"drag",null),_defineProperty(this,"bound",!1),_defineProperty(this,"lastDimmed",null),_defineProperty(this,"keyboardIndex",0),this.host=e,this.resolver=new be(e)},[{key:"bind",value:function bind(){if(this.bound)return this;var e=this.host.ice&&this.host.ice.evtBus;return e?(this.bound=!0,e.on("mousemove",this.onBusMove,this),e.on("mousedown",this.onBusDown,this),e.on("mouseup",this.onBusUp,this),e.on("click",this.onBusClick,this),e.on("dblclick",this.onBusDoubleClick,this),e.on("wheel",this.onBusWheel,this),e.on("keydown",this.onBusKeyDown,this),this):this}},{key:"unbind",value:function unbind(){if(this.bound){this.bound=!1;var e=this.host.ice&&this.host.ice.evtBus;e&&(e.off("mousemove",this.onBusMove,this),e.off("mousedown",this.onBusDown,this),e.off("mouseup",this.onBusUp,this),e.off("click",this.onBusClick,this),e.off("dblclick",this.onBusDoubleClick,this),e.off("wheel",this.onBusWheel,this),e.off("keydown",this.onBusKeyDown,this))}}},{key:"pointOf",value:function pointOf(e){if(!e)return null;var t="number"==typeof e.offsetX?e.offsetX:e.x,i="number"==typeof e.offsetY?e.offsetY:e.y;return"number"!=typeof t||"number"!=typeof i?null:[t,i]}},{key:"isOverCanvas",value:function isOverCanvas(e,t){var i=this.host&&this.host.ice;if(!i)return!1;var r=i.dpr||1,n=(i.canvasWidth||0)/r,a=(i.canvasHeight||0)/r;return!(n>0&&a>0)||e>=0&&t>=0&&e<=n&&t<=a}},{key:"preventDefault",value:function preventDefault(e){var t=e&&e.originalEvent?e.originalEvent:e;if(t&&"function"==typeof t.preventDefault)try{t.preventDefault()}catch(e){}}},{key:"onBusMove",value:function onBusMove(e){var t=this.pointOf(e);t&&this.handlePointerMove(t[0],t[1],e)}},{key:"onBusDown",value:function onBusDown(e){var t=this.pointOf(e);t&&this.handlePointerDown(t[0],t[1],e)}},{key:"onBusUp",value:function onBusUp(e){var t=this.pointOf(e);t&&this.handlePointerUp(t[0],t[1],e)}},{key:"onBusClick",value:function onBusClick(e){var t=this.pointOf(e);t&&this.handleClick(t[0],t[1],e)}},{key:"onBusDoubleClick",value:function onBusDoubleClick(e){var t=this.pointOf(e);t&&this.handleDoubleClick(t[0],t[1],e)}},{key:"onBusWheel",value:function onBusWheel(e){var t=this.pointOf(e);t&&this.handleWheel(t[0],t[1],Number(e.deltaY)||0,e)}},{key:"onBusKeyDown",value:function onBusKeyDown(e){this.handleKeyDown(e&&e.key,e)}},{key:"refreshHover",value:function refreshHover(){var e=this.hover;if(e){var t=this.host.norm;if("item"===e.kind){var i=t.series.find(function(t){return t.id===e.item.series.id})||e.item.series,r=e.item.point.index,n=("pie"===i.type||"funnel"===i.type)&&t.hiddenSlices["".concat(i.id,"#").concat(r)];if(i.hidden||n||!i.points[r])return void this.setHover(null);var a=this.resolver.buildActiveItem(i,r);return a&&this.resolver.isInsidePlot(a.pixel[0],a.pixel[1])?void this.setHover({kind:"item",item:a}):void this.setHover(null)}var o=this.resolver.nearestByXValue(e.column.xValue),s=o?this.resolver.pickColumn(o.pixel[0]):null;s&&("cartesian"!==t.kind||this.resolver.isInsidePlot(s.pixelX,s.items[0].pixel[1]))?this.setHover({kind:"axis",column:s}):this.setHover(null)}}},{key:"resolveTarget",value:function resolveTarget(e,t){return this.resolver.resolveTarget(e,t)}},{key:"handlePointerMove",value:function handlePointerMove(e,t,i){this.drag?this.updateDrag(e,t,i):this.isOverCanvas(e,t)&&this.updateHover(e,t)}},{key:"updateHover",value:function updateHover(e,t){var i=this.host.norm.option.interaction;if(!i||!i.hover||!1!==i.hover.enabled){var r=this.resolveTarget(e,t);if("legend"===r.kind){var n=this.host.legend;return n&&n.hoverIndex!==r.index&&(n.hoverIndex=r.index,n.markDirty()),this.clearDataVisuals(),void this.setHoverState(null)}this.resetLegendHover();var a=this.host.norm.option.tooltip&&this.host.norm.option.tooltip.trigger||"axis";if(this.resolver.isInsidePlot(r.chart[0],r.chart[1])&&"axis"===a){var o=this.resolver.pickColumn(r.chart[0]);if(o)return void this.setHover({kind:"axis",column:o})}if("series"===r.kind&&r.index>=0){var s=this.resolver.seriesOfComponent(r.component),l=s?this.resolver.buildActiveItem(s,r.index):null;if(l)return void this.setHover({kind:"item",item:l})}this.setHover(null)}}},{key:"resetLegendHover",value:function resetLegendHover(){var e=this.host.legend;e&&-1!==e.hoverIndex&&(e.hoverIndex=-1,e.markDirty())}},{key:"setHover",value:function setHover(e){var t=!!this.hover;if(this.hover=e,!e)return this.clearHoverVisuals(),this.dimOthers(null),void(t&&this.host.emit("item:leave",void 0));this.applyHoverVisuals(e),"item"===e.kind?(this.keyboardIndex=e.item.point.index,this.dimOthers(e.item.series.id),this.host.emit("item:hover",this.resolver.toParams(e.item))):(this.dimOthers(null),e.column.items[0]&&this.host.emit("item:hover",this.resolver.toParams(e.column.items[0])))}},{key:"setHoverState",value:function setHoverState(e){this.hover=e}},{key:"applyHoverVisuals",value:function applyHoverVisuals(e){var t=this,i="item"===e.kind?[e.item]:e.column.items,r=i[0];this.syncSeriesHover(i);var n=this.host.highlight;n&&n.setHover(i.map(function(e){return t.markFor(e)}));var a=this.host.crosshair;if(a)if("cartesian"!==this.host.norm.kind||"horizontal"===this.host.norm.orientation)a.hide();else{var o=this.host.norm.option.crosshair&&this.host.norm.option.crosshair.axis||"x";a.show("y"===o?null:r.pixel[0],"x"===o?null:r.pixel[1],this.host.formatAxisValue("x",r.point.xValue),null===r.point.y?"":this.host.formatAxisValue("y",r.point.y))}var s=this.host.tooltip;if(s)if(this.host.norm.option.tooltip&&!1===this.host.norm.option.tooltip.show)s.hide();else{var l=this.buildTooltipContent(e),h="axis"===e.kind?[e.column.pixelX,r.pixel[1]]:[r.pixel[0],r.pixel[1]];s.show(l,h)}}},{key:"buildTooltipContent",value:function buildTooltipContent(e){var t=this,i="item"===e.kind?[e.item]:e.column.items,r=i[0];if(r&&"horizontal"===this.host.norm.orientation)return{title:this.host.formatAxisValue("y",r.point.xValue),rows:i.map(function(e){return{name:e.series.name,value:null===e.point.y?"-":t.host.formatAxisValue("x",e.point.y),color:e.series.color}})};if(r&&"pie"===r.series.type){var n,a=r.series,o=r.point,s=0,l=_createForOfIteratorHelper(a.points);try{for(l.s();!(n=l.n()).done;){var h=n.value;this.host.norm.hiddenSlices["".concat(a.id,"#").concat(h.index)]||(s+=h.y||0)}}catch(e){l.e(e)}finally{l.f()}var u=o.y||0,c=s>0?u/s*100:0;return{title:a.name,rows:[{name:o.name||"".concat(this.host.norm.labels.slice," ").concat(o.index+1),value:"".concat(c.toFixed(1),"%"),color:o.color||a.color}]}}if(r&&"funnel"===r.series.type){var d,f=r.series,p=r.point,v=0,m=_createForOfIteratorHelper(f.points);try{for(m.s();!(d=m.n()).done;){var g=d.value;this.host.norm.hiddenSlices["".concat(f.id,"#").concat(g.index)]||(v+=g.y||0)}}catch(e){m.e(e)}finally{m.f()}var b=v>0?(p.y||0)/v*100:0;return{title:p.name||this.host.formatAxisValue("x",p.xValue),rows:[{name:f.name,value:"".concat(null===p.y?"-":p.y,"(").concat(b.toFixed(1),"%)"),color:p.color||f.color}]}}if(r&&"gauge"===r.series.type){var k=r.series,S=r.point;return{title:S.name||k.name,rows:[{name:k.name,value:null===S.y?"-":String(S.y),color:k.color}]}}if(r&&"liquid"===r.series.type){var w=r.series,A=r.point,_=w.option.liquid||{},M=isFinite(Number(_.min))?Number(_.min):0,C=isFinite(Number(_.max))?Number(_.max):100,T=null===A.y?M:Number(A.y),P=C>M?Math.max(0,Math.min(1,(T-M)/(C-M))):0;return{title:A.name||w.name,rows:[{name:w.name,value:"".concat(T).concat(void 0===_.unit?"%":_.unit),color:w.color},{name:this.host.norm.labels.liquid,value:"".concat((100*P).toFixed(1),"%"),color:this.host.norm.theme.subTextColor}]}}if(r&&("function"===r.series.type||"parametric"===r.series.type)){var I,O,N=r.series,D=r.point.raw||{},H="function"===N.type,R=H?"x":"t",E=Number(H?null!==(I=D.x)&&void 0!==I?I:r.point.xValue:null!==(O=D.t)&&void 0!==O?O:r.point.xValue),L=Number(D.x),z=Number(D.y),B=function fmt(e){return isFinite(e)?String(Number(e.toPrecision(4))):"—"};return{title:"".concat(R," = ").concat(B(E)),rows:H?[{name:N.name,value:B(z),color:N.color},{name:this.host.norm.labels.coordinate,value:"(".concat(B(L),", ").concat(B(z),")"),color:this.host.norm.theme.subTextColor}]:[{name:this.host.norm.labels.coordinate,value:"(".concat(B(L),", ").concat(B(z),")"),color:N.color},{name:"y",value:B(z),color:this.host.norm.theme.subTextColor}]}}if(r&&"radar"===r.series.type){var W=r.series;return{title:W.name,rows:W.points.map(function(e){return{name:e.name||"".concat(e.index+1),value:null===e.y?"-":String(e.y),color:e.index===r.point.index?W.color:t.host.norm.theme.subTextColor}})}}if(r&&"candlestick"===r.series.type){var V=r.point,j=V.ohlc||[0,0,0,0];return{title:this.host.formatAxisValue("x",V.xValue),rows:[{name:"开盘",value:String(j[0]),color:r.series.color},{name:"收盘",value:String(j[1]),color:r.series.color},{name:"最低",value:String(j[2]),color:r.series.color},{name:"最高",value:String(j[3]),color:r.series.color}]}}if(r&&"boxplot"===r.series.type){var U=r.point,X=U.boxplot;if(X){var K=["最小值","下四分位","中位数","上四分位","最大值"];return{title:U.name||this.host.formatAxisValue("x",U.xValue),rows:X.map(function(e,t){return{name:K[t],value:String(e),color:r.series.color}})}}}if(r&&"waterfall"===r.series.type){var G=r.point,Y=G.y||0;return{title:G.name||this.host.formatAxisValue("x",G.xValue),rows:[{name:Y>=0?"增加":"减少",value:"".concat(Y>=0?"+":"").concat(Y),color:r.series.color},{name:"累计",value:String(G.top),color:this.host.norm.theme.subTextColor}]}}if(r&&"treemap"===r.series.type){var q=r.series,$=r.point;q.points.find(function(e){return 0===e.index})&&q.points[0].y;var Z,J=$.y||0,Q=0,ee=_createForOfIteratorHelper(q.points);try{for(ee.s();!(Z=ee.n()).done;){var te=Z.value,ie=te.raw;ie&&Array.isArray(ie.children)&&ie.children.length||(Q+=te.y||0)}}catch(e){ee.e(e)}finally{ee.f()}var re=Q>0?J/Q*100:0;return{title:$.name||String($.xValue),rows:[{name:q.name,value:"".concat(J,"(").concat(re.toFixed(1),"%)"),color:r.series.color}]}}if(r&&"graph"===r.series.type){var ne=this.resolver.seriesComponentOf(r.series),ae=r.point,oe=ne&&ne.nodeCount||0;if(ae.index>=oe){var se=ne&&ne.graph?ne.graph.layout.links[ae.index-oe]:null,le=ne&&ne.graph?ne.graph.layout.nodes:[];return{title:ae.name,rows:[{name:"流量",value:String(se?se.value:ae.y),color:se?se.color:r.series.color}].concat(_toConsumableArray(se&&le[se.source]&&le[se.target]?[{name:"度数",value:String(le[se.source].degree+le[se.target].degree),color:this.host.norm.theme.subTextColor}]:[]))}}return{title:ae.name,rows:[{name:"权重",value:null===ae.y?"-":String(ae.y),color:r.series.color},{name:"连接数",value:String(ne&&ne.graph&&ne.graph.layout.nodes[ae.index]?ne.graph.layout.nodes[ae.index].degree:0),color:this.host.norm.theme.subTextColor}]}}if(r&&"heatmap"===r.series.type){var he=r.point;return{title:he.name||this.host.formatAxisValue("x",he.xValue),rows:[{name:this.host.formatAxisValue("x",he.xValue),value:null===he.y?"-":this.host.formatAxisValue("y",he.y),color:he.color||r.series.color}]}}if(r&&"sankey"===r.series.type){var ue=r.point,ce=!(!ue.raw||!ue.raw.__sankeyLink);return{title:ce?ue.name:"节点",rows:[{name:ce?"流量":ue.name,value:null===ue.y?"-":String(ue.y),color:r.series.color}]}}var de="item"===e.kind?e.item.point.xValue:e.column.xValue,fe=this.host.formatAxisValue("x",de),pe=i.map(function(e){return{name:e.series.name,value:null===e.point.y?"-":t.host.formatAxisValue("y",e.point.y),color:e.series.color}}),ve=this.host.norm.option.tooltip&&this.host.norm.option.tooltip.formatter;if("function"==typeof ve){var ye=ve({items:i.map(function(e){return t.resolver.toParams(e)}),dataIndex:"item"===e.kind?e.item.point.index:e.column.dataIndex,xValue:de});if(Array.isArray(ye))return{title:void 0===ye[0]?fe:String(ye[0]),rows:ye.slice(1).map(function(e,t){return{name:String(e),value:"",color:i[t]?i[t].series.color:"#999999"}})};if("string"==typeof ye)return{title:ye,rows:[]};if(ye&&"object"===_typeof(ye)&&(void 0!==ye.title||void 0!==ye.rows))return{title:ye.title||fe,rows:ye.rows||pe}}return{title:fe,rows:pe}}},{key:"clearHoverVisuals",value:function clearHoverVisuals(){this.clearDataVisuals(),this.resetLegendHover()}},{key:"clearDataVisuals",value:function clearDataVisuals(){this.syncSeriesHover([]),this.host.highlight&&this.host.highlight.setHover([]),this.host.crosshair&&this.host.crosshair.hide(),this.host.tooltip&&this.host.tooltip.hide()}},{key:"syncSeriesHover",value:function syncSeriesHover(e){var t,i=new Map,r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;i.has(n.series.id)||i.set(n.series.id,n.point.index)}}catch(e){r.e(e)}finally{r.f()}var a,o=_createForOfIteratorHelper(this.host.seriesComponents);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=i.get(s.series.id);s.setHoverIndex(void 0===l?null:l)}}catch(e){o.e(e)}finally{o.f()}}},{key:"markFor",value:function markFor(e){var t,i,r=this.resolver.seriesComponentOf(e.series),n=this.host.layout.plot;if(r&&"bar"===e.series.type&&"function"==typeof r.barRectAt){var a=("function"==typeof r.barDrawRectAt?r.barDrawRectAt(e.point.index,1):null)||r.barRectAt(e.point.index),o=a?{x:Math.max(a.x,0),y:Math.max(a.y,0),width:Math.max(0,Math.min(a.x+a.width,n.width)-Math.max(a.x,0)),height:Math.max(0,Math.min(a.y+a.height,n.height)-Math.max(a.y,0))}:null;if(o&&o.width>0&&o.height>0)return{x:n.x+o.x+o.width/2,y:n.y+o.y+o.height/2,width:o.width,height:o.height,color:e.series.color,size:0,shape:"rect"}}return{x:e.pixel[0],y:e.pixel[1],color:e.series.color,size:(t=e.series,i=t.option&&t.option.symbolSize,isFinite(i)?Number(i):"bar"===t.type?10:8),shape:"circle"}}},{key:"dimOthers",value:function dimOthers(e){var t=this.host.norm.option.interaction,i=!!(t&&t.hover&&t.hover.dimOthers),r=i?e:null;if(r!==this.lastDimmed){this.lastDimmed=r;var n,a=this.host.norm.theme.selection.dimOpacity,o=_createForOfIteratorHelper(this.host.seriesComponents);try{for(o.s();!(n=o.n()).done;){var s=n.value,l=i&&null!==r&&s.series.id!==r;s.setState({opacity:l?a:1})}}catch(e){o.e(e)}finally{o.f()}}}},{key:"handlePointerDown",value:function handlePointerDown(e,t,i){if(!this.isOverCanvas(e,t))return!1;ke=this;var r=this.resolveTarget(e,t);if("legend"===r.kind)return!0;var n=this.host.dataZoomSlider;if(n&&r.component===n){var a=n.hitPart(r.local[0],r.local[1]);if(a){this.preventDefault(i),this.setHover(null);var o=n.fractionAt(r.local[0]);if(this.drag={mode:"slider",part:a,startX:e,startY:t,originStart:n.start,originEnd:n.end,anchorFraction:o,moved:!1},n.setActive(a),"track"===a){var s=n.end-n.start,l=clamp$2(o-s/2,0,1-s);this.host.setDomainFromFractions(l,l+s,"slider",!0),n.setActive("window"),this.drag.part="window",this.drag.originStart=l,this.drag.originEnd=l+s}return!0}}if("series"===r.kind&&r.index>=0&&r.component&&"graph"===r.component.seriesType&&"function"==typeof r.component.moveNode&&r.index<(r.component.nodeCount||0)&&(!r.component.graph||!1!==r.component.graph.options.draggable))return this.preventDefault(i),this.setHover(null),this.drag={mode:"graph-node",component:r.component,nodeIndex:r.index,startX:e,startY:t,moved:!1},!0;if(r.component&&"function"==typeof this.host.isMarkComponent&&this.host.isMarkComponent(r.component))return this.setHover(null),!1;if(!this.resolver.isInsidePlot(r.chart[0],r.chart[1]))return!1;var h=this.host.norm.option.interaction||{},u=h.brush,c=h.pan,d=!(!u||!1===u||!1===u.enabled),f=!(!c||!1===c||!c.enabled);return this.preventDefault(i),d?(this.setHover(null),this.drag={mode:"brush",startX:e,startY:t,moved:!1},this.host.brush&&this.host.brush.setRect({x:r.chart[0],y:r.chart[1],width:0,height:0}),!0):!!f&&(this.setHover(null),this.drag={mode:"pan",startX:e,startY:t,domainX:2===this.host.norm.xAxis.domain.length?[this.host.norm.xAxis.domain[0],this.host.norm.xAxis.domain[1]]:null,domainY:[this.host.norm.yAxis.domain[0],this.host.norm.yAxis.domain[1]],moved:!1},!0)}},{key:"handlePointerUp",value:function handlePointerUp(e,t,i){"function"==typeof this.host.finishMarkDrag&&this.host.finishMarkDrag();var r=this.drag;if(r){if(this.drag=null,"brush"===r.mode){if(!r.moved)return this.host.brush&&this.host.brush.setRect(null),void this.updateHover(e,t);var n=this.brushRange(),a=this.host.norm.option.interaction&&this.host.norm.option.interaction.brush;return a&&"zoom"===a.mode&&n&&(this.applyRange(n),this.host.brush&&this.host.brush.setRect(null)),this.host.emit("brush:end",n),void this.updateHover(e,t)}if("slider"===r.mode){var o=this.host.dataZoomSlider;return o&&o.setActive(null),void this.updateHover(e,t)}if("graph-node"===r.mode){var s=r.component;return r.moved&&s&&"function"==typeof s.settle&&s.graph&&!1!==s.graph.options.settleOnDrop&&s.settle(),void this.updateHover(e,t)}"pan"===r.mode&&this.updateHover(e,t)}}},{key:"updateDrag",value:function updateDrag(e,t,i){var r=this.drag;if(r){var n=e-r.startX,a=t-r.startY;if(r.moved||!(Math.abs(n)+Math.abs(a)<3)){r.moved=!0;var o=this.host.layout.plot,s=_slicedToArray(this.host.ice.screenToWorld(r.startX,r.startY),2),l=s[0],h=s[1],u=_slicedToArray(this.host.ice.screenToWorld(e,t),2),c=u[0],d=u[1];if("brush"!==r.mode)if("slider"!==r.mode)if("graph-node"!==r.mode){var f=this.host.norm.option.interaction&&this.host.norm.option.interaction.pan,p=f&&f.axes||"xy";if(("x"===p||"xy"===p)&&r.domainX){var v=this.shiftDomain("x",r.domainX,n);v&&this.host.setDomain("x",v,"pan")}if(("y"===p||"xy"===p)&&r.domainY){var m=this.shiftDomain("y",r.domainY,a);m&&this.host.setDomain("y",m,"pan")}}else{r.moved=!0;var g=r.component,b=_slicedToArray(this.host.ice.screenToWorld(e,t),2),k=b[0],S=b[1],w=g.globalToLocal(k,S);g.moveNode(r.nodeIndex,w[0],w[1]);var A=this.seriesOfGraphComponent(g);if(A){var _=this.resolver.buildActiveItem(A,r.nodeIndex);_&&this.setHover({kind:"item",item:_})}}else{var M=this.host.dataZoomSlider;if(!M)return;r.moved=!0;var C=_slicedToArray(this.host.ice.screenToWorld(e,t),2),T=C[0],P=C[1],I=M.globalToLocal(T,P)[0],O=M.fractionAt(I),N=r.originEnd-r.originStart,D=r.originStart,H=r.originEnd;if("start"===r.part)D=clamp$2(O,0,r.originEnd-.02);else if("end"===r.part)H=clamp$2(O,r.originStart+.02,1);else{var R=O-r.anchorFraction;H=(D=clamp$2(r.originStart+R,0,1-N))+N}this.host.setDomainFromFractions(D,H,"slider",!0)}else{var E=clamp$2(l,o.x,o.x+o.width),L=clamp$2(h,o.y,o.y+o.height),z=clamp$2(c,o.x,o.x+o.width),B=clamp$2(d,o.y,o.y+o.height);this.host.brush&&this.host.brush.setRect({x:Math.min(E,z),y:Math.min(L,B),width:Math.abs(z-E),height:Math.abs(B-L)});var W=this.brushRange();W&&this.host.emit("brush:change",W)}}}}},{key:"shiftDomain",value:function shiftDomain(e,t,i){var r=this.host.norm["x"===e?"xAxis":"yAxis"],n=r.scale;if(!n)return null;var a="x"===e?this.host.layout.plot.width:this.host.layout.plot.height;if(n.isBand()){var o=r.domain,s=o.indexOf(t[0]),l=o.indexOf(t[1]);if(s<0||l<0||o.length<=1)return null;var h=n.step()||a/Math.max(1,o.length),u=l-s,c=clamp$2(s+Math.round(-i/h),0,Math.max(0,o.length-1-u));return[o[c],o[c+u]]}var d=Number(t[1])-Number(t[0]),f=-i/Math.max(1,a)*d;return[Number(t[0])+f,Number(t[1])+f]}},{key:"handleClick",value:function handleClick(e,t,i){if(this.isOverCanvas(e,t)){var r=this.resolveTarget(e,t),n=this.host.norm.option.interaction;if("legend"!==r.kind){if("series"===r.kind&&r.index>=0){var a=this.resolver.seriesOfComponent(r.component),o=a?this.resolver.buildActiveItem(a,r.index):null;if(o){var s=this.resolver.toParams(o);this.host.emit("item:click",s);var l=n&&n.select;return void(l&&l.enabled&&this.toggleSelection(o.series.id,o.point.index,l.mode||"single",!1!==l.toggle))}}if(this.resolver.isInsidePlot(r.chart[0],r.chart[1])){var h=this.host.layout.plot;this.host.emit("plot:click",{screen:[e,t],xValue:this.host.norm.xAxis.scale?this.host.norm.xAxis.scale.invert(r.chart[0]-h.x):void 0,yValue:this.host.norm.yAxis.scale?this.host.norm.yAxis.scale.invert(r.chart[1]-h.y):void 0})}else this.host.emit("chart:click",{screen:[e,t]})}else{var u=this.host.legend;if(u&&r.index>=0){var c=u.items[r.index];void 0!==c.dataIndex?this.host.toggleSlice(c.seriesId,c.dataIndex):this.host.toggleSeries(c.seriesId)}}}}},{key:"handleDoubleClick",value:function handleDoubleClick(e,t,i){if(this.isOverCanvas(e,t)){var r=this.resolveTarget(e,t);if(!("series"!==r.kind||r.index<0)){var n=this.resolver.seriesOfComponent(r.component),a=n?this.resolver.buildActiveItem(n,r.index):null;a&&this.host.emit("item:dblclick",this.resolver.toParams(a))}}}},{key:"toggleSelection",value:function toggleSelection(e,t,i,r){var n=this.selection.findIndex(function(i){return i.seriesId===e&&i.dataIndex===t});"single"===i?this.selection=n>=0&&r?[]:[{seriesId:e,dataIndex:t}]:n>=0?this.selection.splice(n,1):this.selection.push({seriesId:e,dataIndex:t}),this.refreshSelectionVisuals(),this.host.emit("select:change",this.getSelectedParams())}},{key:"clearSelection",value:function clearSelection(){this.selection.length&&(this.selection=[],this.refreshSelectionVisuals(),this.host.emit("select:change",[]))}},{key:"refreshSelectionVisuals",value:function refreshSelectionVisuals(){var e=this,t=this.host.highlight;if(t){var i,r=[],n=_createForOfIteratorHelper(this.selection);try{var a=function _loop(){var t=i.value,n=e.host.norm.series.find(function(e){return e.id===t.seriesId});if(!n)return 1;var a=e.resolver.buildActiveItem(n,t.dataIndex);a&&r.push(e.markFor(a))};for(n.s();!(i=n.n()).done;)a()}catch(e){n.e(e)}finally{n.f()}t.setSelection(r)}}},{key:"getSelectedParams",value:function getSelectedParams(){var e,t=this,i=[],r=_createForOfIteratorHelper(this.selection);try{var n=function _loop2(){var r=e.value,n=t.host.norm.series.find(function(e){return e.id===r.seriesId});if(!n)return 1;var a=t.resolver.buildActiveItem(n,r.dataIndex);a&&i.push(t.resolver.toParams(a))};for(r.s();!(e=r.n()).done;)n()}catch(e){r.e(e)}finally{r.f()}return i}},{key:"brushRect",get:function get(){return this.host.brush?this.host.brush.rect:null}},{key:"brushRange",value:function brushRange(){var e=this.brushRect,t=this.host.layout.plot;if(!e||e.width<2&&e.height<2)return null;var i=this.host.norm.option.interaction&&this.host.norm.option.interaction.brush,r=i&&i.axes||"x",n={};if("x"===r||"xy"===r){var a=this.valueAtPixel("x",e.x-t.x),o=this.valueAtPixel("x",e.x+e.width-t.x),s=this.orderValues("x",a,o);s&&(n.x=s)}if("y"===r||"xy"===r){var l=this.valueAtPixel("y",e.y-t.y),h=this.valueAtPixel("y",e.y+e.height-t.y),u=this.orderValues("y",l,h);u&&(n.y=u)}return n.x||n.y?n:null}},{key:"valueAtPixel",value:function valueAtPixel(e,t){var i=this.host.norm["x"===e?"xAxis":"yAxis"],r=i.scale;if(r){if(r.isBand()){var n=r.indexAt(t),a=n>=0?n:r.nearestIndex?r.nearestIndex(t):0;return i.domain[clamp$2(a,0,i.domain.length-1)]}return r.invert(t)}}},{key:"orderValues",value:function orderValues(e,t,i){if(void 0===t||void 0===i)return null;var r=this.host.norm["x"===e?"xAxis":"yAxis"].scale;if(r&&r.isBand()){var n=this.host.norm["x"===e?"xAxis":"yAxis"].domain;return n.indexOf(t)<=n.indexOf(i)?[t,i]:[i,t]}return Number(t)<=Number(i)?[t,i]:[i,t]}},{key:"applyRange",value:function applyRange(e){e.x&&this.host.setDomain("x",e.x,"brush"),e.y&&this.host.setDomain("y",e.y,"brush")}},{key:"handleWheel",value:function handleWheel(e,t,i,r){var n=this.host.norm.option.interaction&&this.host.norm.option.interaction.zoom;if(!n||!1===n||!1===n.enabled||!1===n.wheel)return!1;var a=this.resolveTarget(e,t);if(!this.resolver.isInsidePlot(a.chart[0],a.chart[1]))return!1;this.preventDefault(r);var o=Number(n.wheelFactor)||1.2,s=i<0?o:1/o;if("viewport"===n.mode)return this.host.ice.zoomAt(e,t,s),!0;var l=n.axes||"x",h=this.host.layout.plot;if("x"===l||"xy"===l){var u=this.zoomDomain("x",a.chart[0]-h.x,s);u&&this.host.setDomain("x",u,"zoom")}if("y"===l||"xy"===l){var c=this.zoomDomain("y",a.chart[1]-h.y,s);c&&this.host.setDomain("y",c,"zoom")}return!0}},{key:"zoomDomain",value:function zoomDomain(e,t,i){var r=this.host.norm["x"===e?"xAxis":"yAxis"],n=r.scale;if(!n)return null;var a=this.host.norm.option.interaction&&this.host.norm.option.interaction.zoom,o=Number(a&&a.minSpan)||.05,s=Number(a&&a.maxSpan)||1,l=this.host.fullDomain(e),h="x"===e?this.host.layout.plot.width:this.host.layout.plot.height;if(n.isBand()){var u=l,c=u.length;if(c<=2)return null;var d=r.domain,f=Math.max(0,u.indexOf(d[0])),p=u.indexOf(d[d.length-1]),v=Math.max(2,p-f+1),m=clamp$2(t/Math.max(1,h),0,1),g=Math.round(clamp$2(v/i,Math.max(2,Math.ceil(c*o)),Math.floor(c*s)));g=Math.min(g,c);var b=f+m*(v-1),k=Math.round(b-m*(g-1));return[u[k=clamp$2(k,0,Math.max(0,c-g))],u[k+g-1]]}var S=Number(r.domain[0]),w=Number(r.domain[1])-S,A=Number(l[1])-Number(l[0]),_=clamp$2(w/i,A*o,A*s),M=n.invert(t),C=M-(0===w?.5:(M-S)/w)*_;return[C,C+_]}},{key:"currentRange",value:function currentRange(){return{x:[this.host.norm.xAxis.domain[0],this.host.norm.xAxis.domain[1]],y:[Number(this.host.norm.yAxis.domain[0]),Number(this.host.norm.yAxis.domain[1])]}}},{key:"handleKeyDown",value:function handleKeyDown(e,t){var i=this.host.norm.option.interaction;if(i&&!1===i.keyboard)return!1;if(!e)return!1;if(ke&&ke!==this&&ke.host)return!1;if(t&&t.target&&/^(INPUT|TEXTAREA|SELECT)$/.test(t.target.tagName||""))return!1;var r=this.host.norm.series.filter(function(e){return!e.hidden});if(!r.length)return!1;var n=0;if(this.hover){var a="item"===this.hover.kind?this.hover.item.series.id:this.hover.column.items[0].series.id,o=r.findIndex(function(e){return e.id===a});o>=0&&(n=o)}var s=!1;switch(e){case"ArrowRight":case"ArrowLeft":var l=r[n];if(!l.points.length)break;var h=this.stepVisibleIndex(l,"ArrowRight"===e?1:-1);if(h>=0){this.keyboardIndex=h;var u=this.resolver.buildActiveItem(l,h);u&&this.setHover({kind:"item",item:u})}s=h>=0;break;case"ArrowUp":case"ArrowDown":var c=r[clamp$2(n+("ArrowDown"===e?1:-1),0,r.length-1)];if(!c.points.length)break;var d=clamp$2(this.keyboardIndex,0,c.points.length-1),f=this.resolver.buildActiveItem(c,d);f&&this.setHover({kind:"item",item:f}),s=!0;break;case"Escape":this.setHover(null),this.clearSelection(),this.host.brush&&this.host.brush.setRect(null),s=!0;break;case"Enter":case" ":if(this.hover&&"item"===this.hover.kind){var p=this.hover.item,v=i&&i.select;this.toggleSelection(p.series.id,p.point.index,v&&v.mode||"single",!0),this.host.emit("item:click",this.resolver.toParams(p)),s=!0}}return s&&this.preventDefault(t),s}},{key:"showHoverAtValue",value:function showHoverAtValue(e){var t=this.resolver.nearestByXValue(e);t&&this.setHover({kind:"item",item:t})}},{key:"clearHover",value:function clearHover(){this.setHover(null)}},{key:"seriesOfGraphComponent",value:function seriesOfGraphComponent(e){var t,i=_createForOfIteratorHelper(this.host.norm.series);try{for(i.s();!(t=i.n()).done;){var r=t.value;if(this.resolver.seriesComponentOf(r)===e)return r}}catch(e){i.e(e)}finally{i.f()}return null}},{key:"stepVisibleIndex",value:function stepVisibleIndex(e,t){var i=e.points.length;if(!i)return-1;for(var r=clamp$2(this.keyboardIndex,0,i-1),n=0;n<i;n++){var a=r+t;if(a<0||a>=i)return-1;r=a;var o=this.resolver.buildActiveItem(e,r);if(o&&this.resolver.isInsidePlot(o.pixel[0],o.pixel[1]))return r}return-1}},{key:"destroy",value:function destroy(){this.unbind(),ke===this&&(ke=null),this.host=null}}])}();var we=function(){return _createClass(function Emitter(){_classCallCheck(this,Emitter),_defineProperty(this,"listeners",new Map)},[{key:"on",value:function on(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.listeners.get(e)||[];return this.off(e,t,i),r.push({fn:t,scope:i}),this.listeners.set(e,r),this}},{key:"once",value:function once(e,t){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=function wrapper(a){i.off(e,n,r),t.call(r,a)};return n.__onceOriginal=t,this.on(e,n,r)}},{key:"off",value:function off(e,t,i){var r=this.listeners.get(e);if(!r)return this;if(!t)return this.listeners.delete(e),this;for(var n=r.length-1;n>=0;n--){var a=r[n],o=a.fn;!(o===t||o&&o.__onceOriginal===t)||void 0!==i&&a.scope!==i||r.splice(n,1)}return r.length||this.listeners.delete(e),this}},{key:"emit",value:function emit(e,t){var i=this.listeners.get(e);if(!i||!i.length)return!1;for(var r=i.slice(),n=0;n<r.length;n++)r[n].fn.call(r[n].scope,t);return!0}},{key:"hasListener",value:function hasListener(e){var t=this.listeners.get(e);return!!t&&t.length>0}},{key:"clear",value:function clear(){this.listeners.clear()}}])}();function chartTitle(e){var t=e.option.title&&e.option.title.text;return t?String(t):e.labels.chart}function buildDataTable(e){var t=e.norm,i=chartTitle(t),r=t.series.filter(function(e){return!e.hidden&&"pie"!==e.type});if("polar"===t.kind){var n=t.series.find(function(e){return"pie"===e.type});if(!n)return{caption:i,columns:[t.labels.sector,t.labels.value,t.labels.ratio],rows:[]};var a=n.points.filter(function(e){return!t.hiddenSlices["".concat(n.id,"#").concat(e.index)]}),o=a.reduce(function(e,t){return e+(t.y||0)},0);return{caption:i,columns:[t.labels.sector,t.labels.value,t.labels.ratio],rows:a.map(function(e){return[e.name||"".concat(n.name," ").concat(e.index+1),null===e.y?"":String(e.y),o>0?"".concat(((e.y||0)/o*100).toFixed(1),"%"):"0%"]})}}if("radar"===t.kind){var s=t.radar&&t.radar.indicators||[];return{caption:i,columns:["指标"].concat(_toConsumableArray(r.map(function(e){return e.name}))),rows:s.map(function(e,t){return[e.name].concat(_toConsumableArray(r.map(function(e){var i=e.points[t];return i&&null!==i.y?String(i.y):""})))})}}var l,h=[t.xAxis.option&&t.xAxis.option.name||"类目"].concat(_toConsumableArray(r.map(function(e){return e.name}))),u=[],c={},d=_createForOfIteratorHelper(r);try{for(d.s();!(l=d.n()).done;){var f,p=l.value,v=_createForOfIteratorHelper(p.points);try{for(v.s();!(f=v.n()).done;){var m=f.value,g=String(m.xValue);c[g]||(c[g]={x:m.xValue,cells:{}},u.push(g)),c[g].cells[p.id]=null===m.y?"":e.formatAxisValue("y",m.y)}}catch(e){v.e(e)}finally{v.f()}}}catch(e){d.e(e)}finally{d.f()}var b=u.map(function(t){var i=c[t];return[e.formatAxisValue("x",i.x)].concat(_toConsumableArray(r.map(function(e){return i.cells[e.id]||""})))});return{caption:i,columns:h,rows:b}}function buildDataNodes(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Math.max(0,void 0===i.maxDataNodesPerSeries?200:i.maxDataNodesPerSeries),n=[],a=_createForOfIteratorHelper(e.norm.series);try{for(a.s();!(t=a.n()).done;){var o=t.value;if(!o.hidden){var s=e.controller&&e.controller.resolver?e.controller.resolver.seriesComponentOf(o):null;if(s)for(var l=Math.min(o.points.length,r),h=0;h<l;h++){var u=o.points[h],c=s.pixelAt(h);if(c){var d=[e.layout.plot.x+c[0],e.layout.plot.y+c[1]],f=e.ice&&"function"==typeof e.ice.worldToScreen?e.ice.worldToScreen(d[0],d[1]):d,p=seriesSymbolSize(o);n.push({id:"".concat(o.id,"#").concat(h),role:"graphic",label:"".concat(o.name,",").concat(e.formatAxisValue("x",u.xValue),",").concat(null===u.y?"无数据":e.formatAxisValue("y",u.y)),seriesId:o.id,seriesName:o.name,dataIndex:h,value:u.y,box:{x:f[0]-p/2,y:f[1]-p/2,width:p,height:p},focusable:!0})}}}}}catch(e){a.e(e)}finally{a.f()}return n}function seriesSymbolSize(e){var t=e.option.symbolSize;return"number"==typeof t&&isFinite(t)?Math.max(8,t):"bar"===e.type?12:10}var Ae=["position:absolute","width:1px","height:1px","margin:-1px","padding:0","overflow:hidden","clip:rect(0 0 0 0)","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),_e=function(){function A11yMirror(e){_classCallCheck(this,A11yMirror),_defineProperty(this,"wrapper",null),_defineProperty(this,"live",null),_defineProperty(this,"tableEl",null),_defineProperty(this,"hoverHandler",null),this.chart=e}return _createClass(A11yMirror,[{key:"attached",get:function get(){return!!this.wrapper}},{key:"element",get:function get(){return this.wrapper}},{key:"attach",value:function attach(){var e=this,t=this.chart.ice,i=this.chart.canvasElement,r=t&&t.root&&t.root.document;if(!r||!i||"function"!=typeof r.createElement||!i.parentNode)return!1;this.detach();var n=r.createElement("div");n.id="ice-chart-a11y-mirror-".concat(++A11yMirror.seq),n.setAttribute("style",Ae),n.setAttribute("data-ice-chart-a11y","mirror"),this.tableEl=r.createElement("table");var a=r.createElement("div");return a.setAttribute("role","status"),a.setAttribute("aria-live","polite"),n.appendChild(this.tableEl),n.appendChild(a),i.parentNode.appendChild(n),i.setAttribute("aria-describedby",n.id),i.getAttribute("aria-label")||i.setAttribute("aria-label",chartTitle(this.chart.norm)),this.wrapper=n,this.live=a,this.refresh(),this.hoverHandler=function(t){t&&e.announce("".concat(t.seriesName,",").concat(e.chart.formatAxisValue("x",t.xValue),",").concat(null===t.value?"无数据":e.chart.formatAxisValue("y",t.value)))},this.chart.on("item:hover",this.hoverHandler),!0}},{key:"detach",value:function detach(){this.hoverHandler&&(this.chart.off("item:hover",this.hoverHandler),this.hoverHandler=null);var e=this.chart.canvasElement;this.wrapper&&this.wrapper.parentNode&&this.wrapper.parentNode.removeChild(this.wrapper),e&&"function"==typeof e.removeAttribute&&e.removeAttribute("aria-describedby"),this.wrapper=null,this.live=null,this.tableEl=null}},{key:"refresh",value:function refresh(){var e=this.chart.ice&&this.chart.ice.root&&this.chart.ice.root.document;if(this.wrapper&&this.tableEl&&e){for(var t=buildDataTable(this.chart);this.tableEl.firstChild;)this.tableEl.removeChild(this.tableEl.firstChild);var i=e.createElement("caption");i.textContent=t.caption,this.tableEl.appendChild(i);var r,n=e.createElement("thead"),a=e.createElement("tr"),o=_createForOfIteratorHelper(t.columns);try{for(o.s();!(r=o.n()).done;){var s=r.value,l=e.createElement("th");l.setAttribute("scope","col"),l.textContent=s,a.appendChild(l)}}catch(e){o.e(e)}finally{o.f()}n.appendChild(a),this.tableEl.appendChild(n);var h,u=e.createElement("tbody"),c=_createForOfIteratorHelper(t.rows);try{for(c.s();!(h=c.n()).done;){for(var d=h.value,f=e.createElement("tr"),p=0;p<d.length;p++){var v=e.createElement(0===p?"th":"td");0===p&&v.setAttribute("scope","row"),v.textContent=d[p],f.appendChild(v)}u.appendChild(f)}}catch(e){c.e(e)}finally{c.f()}this.tableEl.appendChild(u)}}},{key:"announce",value:function announce(e){this.live&&(this.live.textContent=e)}}])}();_defineProperty(_e,"seq",0);function layoutTreemap(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,a=[],o=Math.max(0,Number(r.gap)||2),s=void 0===r.depthFade?.18:Math.max(0,Math.min(1,Number(r.depthFade)));if(!Array.isArray(e)||!e.length)return a;var l=sumValues(e);if(!(l>0))return a;var h=0,u=function visit(e,t,i,r,n){if(!(t.width<=1||t.height<=1)){var c=e.map(function(e){return{node:e,value:nodeValue(e)}}).filter(function(e){return e.value>0});if(c.length){c.sort(function(e,t){return t.value-e.value});for(var d=c.reduce(function(e,t){return e+t.value},0),f=function squarify(e,t,i){var r=[],n=_objectSpread2({},t),a=e.slice(),o=t.width*t.height/i;if(!(o>0))return r;for(;a.length;){var s=Math.min(n.width,n.height);if(!(s>0))break;for(var l=[],h=0;a.length;){var u=a[0],c=h+u.value*o,d=l.length?worstRatio(l,h,s):1/0,f=worstRatio([].concat(l,[u]),c,s);if(l.length&&f>d)break;l.push(a.shift()),h=c}for(var p=n.width>=n.height,v=h/s,m=0,g=0,b=l;g<b.length;g++){var k=b[g],S=k.value*o/v,w=p?{x:n.x,y:n.y+m,width:v,height:S}:{x:n.x+m,y:n.y,width:S,height:v};r.push({item:k,box:w}),m+=S}n=p?{x:n.x+v,y:n.y,width:Math.max(0,n.width-v),height:n.height}:{x:n.x,y:n.y+v,width:n.width,height:Math.max(0,n.height-v)}}return r}(c,t,d),p=0;p<f.length;p++){var v=f[p],m=v.item,g=v.box,b=m.node.color||shade(n,i*s),k=Array.isArray(m.node.children)?m.node.children:[],S=k.length>0,w=h++,A=S&&g.height>32?16:0;if(a.push({id:w,name:m.node.name,depth:i,parent:r,value:m.value,ratio:m.value/l,rect:g,header:A,color:b,hasChildren:S}),S){var _={x:g.x+o,y:g.y+o+A,width:Math.max(0,g.width-2*o),height:Math.max(0,g.height-2*o-A)};u(k,_,i+1,w,b)}}}}};return u(e,i,0,-1,n[0]),a.filter(function(e){return 0===e.depth}).forEach(function(e,t){var i=n[t%n.length];e.color=i,recolor(a,e.id,i,n,s)}),a}function recolor(e,t,i,r,n){var a,o=_createForOfIteratorHelper(e);try{for(o.s();!(a=o.n()).done;){var s=a.value;s.parent===t&&(s.color=shade(i,s.depth*n),recolor(e,s.id,s.color,r,n))}}catch(e){o.e(e)}finally{o.f()}}function sumValues(e){var t,i=0,r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){i+=nodeValue(t.value)}}catch(e){r.e(e)}finally{r.f()}return i}function nodeValue(e){if(Array.isArray(e.children)&&e.children.length)return sumValues(e.children);var t=Number(e.value);return isFinite(t)&&t>0?t:0}function worstRatio(e,t,i){if(!(t>0&&i>0))return 1/0;var r,n=0,a=1/0,o=_createForOfIteratorHelper(e);try{for(o.s();!(r=o.n()).done;){var s=r.value;s.value>n&&(n=s.value),s.value<a&&(a=s.value)}}catch(e){o.e(e)}finally{o.f()}if(!(a>0))return 1/0;var l=t,h=i;return Math.max(h*h*n/(l*l),l*l/(h*h*a))}function shade(e,t){var i=function parseHex(e){if("string"!=typeof e)return null;var t=e.trim();if(0===t.indexOf("#"))return 3===(t=t.slice(1)).length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?null:[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];var i=t.match(/rgba?\(([^)]+)\)/);if(i){var r=i[1].split(",").map(function(e){return parseFloat(e)});return[r[0]||0,r[1]||0,r[2]||0]}return null}(e);if(!i)return e;var r=Math.max(0,Math.min(1,t)),n=Math.round(i[0]+(255-i[0])*r),a=Math.round(i[1]+(255-i[1])*r),o=Math.round(i[2]+(255-i[2])*r);return"rgb(".concat(n,",").concat(a,",").concat(o,")")}var Me=10,Ce=20,Te=100,Pe=300,Fe=310,Ie=400,Oe=450,Ne=500,De=600,He=620,Re=640,Ee=700;function isChartSnapshot(e){return!!e&&"object"===_typeof(e)&&!Array.isArray(e)&&!!e.option&&("version"in e||"view"in e||"hidden"in e)}function mergeOptionPatch(e,t){var i=_objectSpread2(_objectSpread2({},e),t);return Array.isArray(t&&t.series)&&Array.isArray(e&&e.series)&&(i.series=e.series.map(function(e,i){var r=t.series.find(function(t){return t&&t.id&&e&&e.id&&t.id===e.id}),n=t.series[i],a=r||(n&&!n.id?n:void 0);return a?_objectSpread2(_objectSpread2({},e),a):e})),i}var Le=function(){function ICEChart(t,i){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(_classCallCheck(this,ICEChart),_defineProperty(this,"axisYList",[]),_defineProperty(this,"legend",null),_defineProperty(this,"titleComponent",null),_defineProperty(this,"tooltip",null),_defineProperty(this,"crosshair",null),_defineProperty(this,"highlight",null),_defineProperty(this,"brushComponent",null),_defineProperty(this,"dataZoomSlider",null),_defineProperty(this,"seriesComponents",[]),_defineProperty(this,"markLayer",null),_defineProperty(this,"marks",[]),_defineProperty(this,"markSeq",0),_defineProperty(this,"syncingMarks",!1),_defineProperty(this,"fullXDomain",[]),_defineProperty(this,"fullYDomain",[]),_defineProperty(this,"fullYDomains",[]),_defineProperty(this,"emitter",new we),_defineProperty(this,"viewState",{x:null,y:null,yAxes:[]}),_defineProperty(this,"autoYCurve",!1),_defineProperty(this,"hiddenIds",{}),_defineProperty(this,"hiddenSlices",{}),_defineProperty(this,"seriesSignature",""),_defineProperty(this,"axisSignature",""),_defineProperty(this,"resizeObserver",null),_defineProperty(this,"destroyed",!1),_defineProperty(this,"silenceDepth",0),_defineProperty(this,"__appliedEngineThemeKey",null),_defineProperty(this,"__offThemeFollow",null),_defineProperty(this,"a11yMirror",new _e(this)),_defineProperty(this,"domainTransition",null),_defineProperty(this,"domainFrameHandler",null),!t)throw new Error("[ice-chart] 初始化失败:缺少 canvas 元素或其 id。");this.chartOptions=n,this.option=i,this.ice=new e.ICE,this.ice.init(t,{renderMode:n.renderMode||"dirty-rect",dpr:n.dpr}),this.canvasEl=this.ice.canvasEl||t,this.registerTypes();var a=this.canvasRect();this.root=new e.ICEGroup({left:0,top:0,width:a.width,height:a.height,origin:"top-left",fill:!1,stroke:!1,interactive:!1,draggable:!1,transformable:!1,linkable:!1,clipChildren:!0,zIndex:0}),this.ice.addChild(this.root),this.plotArea=new E({left:0,top:0,width:1,height:1,zIndex:Me}),this.grid=new D({width:a.width,height:a.height,zIndex:Ce}),this.annotation=new R({width:a.width,height:a.height,zIndex:Fe}),this.radarGrid=new U({width:a.width,height:a.height,zIndex:Ce+5}),this.polarGrid=new X({width:a.width,height:a.height,zIndex:Ce+6}),this.axisX=new N({orientation:"x",width:a.width,height:a.height,zIndex:Ie}),this.axisYList=[new N({orientation:"y",width:a.width,height:a.height,zIndex:Ie,axisIndex:0,position:"left"})],this.legend=new L({width:a.width,height:a.height,zIndex:Ne}),this.titleComponent=new z({width:a.width,height:a.height,zIndex:Oe}),this.crosshair=new W({width:a.width,height:a.height,zIndex:De}),this.highlight=new V({width:a.width,height:a.height,zIndex:He}),this.brushComponent=new j({width:a.width,height:a.height,zIndex:Re}),this.dataZoomSlider=new K({left:0,top:0,width:a.width,height:26,zIndex:Re+5}),this.tooltip=new B({width:a.width,height:a.height,zIndex:Ee}),this.root.addChildren([this.plotArea,this.grid,this.annotation,this.radarGrid,this.polarGrid,this.axisX].concat(_toConsumableArray(this.axisYList),[this.titleComponent,this.legend,this.crosshair,this.highlight,this.brushComponent,this.dataZoomSlider,this.tooltip])),this.controller=new Se(this),this.applyOption(i,{animate:"enter",preserveView:!1}),this.controller.bind(),this.__offThemeFollow=this.ice.onThemeChange(function(e){"theme"!==e.kind||r.destroyed||r.option&&"auto"===r.option.theme&&r.rebuild(!1)}),n.autoResize&&this.observeResize()}return _createClass(ICEChart,[{key:"brush",get:function get(){return this.brushComponent}},{key:"setOption",value:function setOption(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.applyOption(e,{animate:void 0===t.animate||t.animate,preserveView:!1!==t.preserveView}),this}},{key:"getOption",value:function getOption(){return this.option}},{key:"expressionDiagnostics",value:function expressionDiagnostics(){var e,t=[],i=_createForOfIteratorHelper(this.norm.series);try{for(i.s();!(e=i.n()).done;){var r=e.value;r.expressionDiagnostics&&r.expressionDiagnostics.length&&t.push({seriesId:r.id,diagnostics:r.expressionDiagnostics})}}catch(e){i.e(e)}finally{i.f()}return t}},{key:"expressionErrors",value:function expressionErrors(){var e,t=[],i=_createForOfIteratorHelper(this.norm.series);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(r.expressionDiagnostics){var n,a=_createForOfIteratorHelper(r.expressionDiagnostics);try{for(a.s();!(n=a.n()).done;){var o=n.value;"error"===o.severity&&t.push({seriesId:r.id,message:o.message})}}catch(e){a.e(e)}finally{a.f()}}}}catch(e){i.e(e)}finally{i.f()}return t}},{key:"annotationDiagnostics",value:function annotationDiagnostics(){return this.annotation?this.annotation.diagnostics.slice():[]}},{key:"annotationErrors",value:function annotationErrors(){return this.annotationDiagnostics().filter(function(e){return"error"===e.severity})}},{key:"setData",value:function setData(e,t){var i=(this.option.series||[]).map(function(e,t){return{item:e,index:t}}).find(function(t){return"number"==typeof e?t.index===e:t.item.id===e||t.item.name===e});if(!i)throw new Error("[ice-chart] 找不到系列:".concat(e));return i.item.data=t,this.applyOption(this.option,{animate:!0,preserveView:!0}),this.emit("data:change",{seriesId:i.item.id,seriesIndex:i.index}),this}},{key:"appendData",value:function appendData(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null==e)throw new Error("[ice-chart] appendData 需要系列 id / name / 下标。");var r=(this.option.series||[]).map(function(e,t){return{item:e,index:t}}).find(function(t){return"number"==typeof e?t.index===e:t.item.id===e||t.item.name===e});if(!r)throw new Error("[ice-chart] 找不到系列:".concat(e));var n=Array.isArray(t)?t:[];if(!n.length)return this;var a=(r.item.data||[]).concat(n),o=Number(i.maxPoints);return r.item.data=isFinite(o)&&o>0&&a.length>o?a.slice(a.length-o):a,this.applyOption(this.option,{animate:!0===i.animate,preserveView:!0}),this.emit("data:change",{seriesId:r.item.id,seriesIndex:r.index}),this}},{key:"setDomain",value:function setDomain(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"api";if(this.destroyed)return this;var r="x"!==e||"zoom"!==i&&"brush"!==i?t:this.guardInteractiveXWindow(t),n=this.clampDomain(e,r);if(!n)return this;"x"===e?this.viewState.x=n:this.viewState.y=n,this.rebuild(!1);var a=this.currentRange();return this.emit("pan"===i?"pan:change":"zoom:change",a),this}},{key:"numericXValues",value:function numericXValues(){var e,t=new Set,i=_createForOfIteratorHelper(this.norm.series);try{for(i.s();!(e=i.n()).done;){var r,n=_createForOfIteratorHelper(e.value.points);try{for(n.s();!(r=n.n()).done;){var a=r.value,o=Number(a.xValue);isFinite(o)&&t.add(o)}}catch(e){n.e(e)}finally{n.f()}}}catch(e){i.e(e)}finally{i.f()}return _toConsumableArray(t).sort(function(e,t){return e-t})}},{key:"guardInteractiveXWindow",value:function guardInteractiveXWindow(e){if("category"===this.norm.xAxis.type){var t=this.fullXDomain;if(t.length<2)return e;var i=t.indexOf(e[0]),r=t.indexOf(e[1]);return i<0&&r<0?e:(i<0&&(i=0),r<0&&(r=t.length-1),r-i>=1?e:(i>0?i-=1:r<t.length-1&&(r+=1),[t[i],t[r]]))}var n=this.numericXValues();if(n.length<2)return e;var a=n.length>=3?2:1,o=Number(e[0]),s=Number(e[1]);if(!isFinite(o)||!isFinite(s)||s<=o)return e;for(var l=n.filter(function(e){return e>=o&&e<=s}).length,h=0;l<a&&h<4;){h+=1;var u=_toConsumableArray(n).reverse().find(function(e){return e<o}),c=n.find(function(e){return e>s});if(void 0===u&&void 0===c)break;(void 0===u?1/0:o-u)<=(void 0===c?1/0:c-s)?o=u:s=c,l=n.filter(function(e){return e>=o&&e<=s}).length}return l>=a?[o,s]:e}},{key:"addMark",value:function addMark(e){var t=this,i=e.id||"mark-".concat(++this.markSeq);if(this.marks.some(function(e){return e.id===i}))throw new Error("[ice-chart] addMark:id「".concat(i,"」已经存在"));if(!e||!e.component)throw new Error("[ice-chart] addMark:必须提供 component(一个引擎图元实例)");var r=e.type||"point";if("point"!==r&&"xLine"!==r&&"yLine"!==r&&"xBand"!==r&&"yBand"!==r)throw new Error("[ice-chart] addMark:不支持的 type「".concat(String(r),"」"));var n={id:i,spec:_objectSpread2(_objectSpread2({},e),{},{id:i}),component:e.component,dragging:!1};return this.marks.push(n),this.ensureMarkLayer().addChild(e.component),"function"==typeof e.component.on&&e.component.on("AFTER_MOVE",function(e){if(!t.syncingMarks){var i=e&&isFinite(e.left)&&isFinite(e.top)?{left:Number(e.left),top:Number(e.top)}:void 0,a=t.markDataAt(n,i);"point"===r?(n.spec.x=a.xValue,n.spec.y=a.yValue):"xLine"===r||"xBand"===r?"xLine"===r?n.spec.x=a.xValue:n.spec.x0=a.xValue:"yLine"===r?n.spec.y=a.yValue:n.spec.y0=a.yValue,n.dragging=!0,t.syncMarks(),t.emit("mark:drag",a),"function"==typeof n.spec.onDrag&&n.spec.onDrag(a)}}),this.syncMarks(),this.markHandle(n)}},{key:"getMark",value:function getMark(e){var t=this.marks.find(function(t){return t.id===e});return t?this.markHandle(t):null}},{key:"getMarks",value:function getMarks(){var e=this;return this.marks.map(function(t){return e.markHandle(t)})}},{key:"removeMark",value:function removeMark(e){var t=this.marks.findIndex(function(t){return t.id===e});if(t<0)return!1;var i=_slicedToArray(this.marks.splice(t,1),1)[0];return this.markLayer&&i.component&&this.markLayer.removeChild(i.component),!0}},{key:"clearMarks",value:function clearMarks(){var e,t=_createForOfIteratorHelper(this.marks);try{for(t.s();!(e=t.n()).done;){var i=e.value;this.markLayer&&i.component&&this.markLayer.removeChild(i.component)}}catch(e){t.e(e)}finally{t.f()}this.marks=[]}},{key:"isMarkComponent",value:function isMarkComponent(e){return!!e&&this.marks.some(function(t){return t.component===e})}},{key:"finishMarkDrag",value:function finishMarkDrag(){var e,t=_createForOfIteratorHelper(this.marks);try{for(t.s();!(e=t.n()).done;){var i=e.value;i.dragging&&(i.dragging=!1,this.emit("mark:dragend",this.markDataAt(i)))}}catch(e){t.e(e)}finally{t.f()}}},{key:"ensureMarkLayer",value:function ensureMarkLayer(){if(this.markLayer)return this.markLayer;var t=this.layout?this.layout.canvas:this.canvasRect(),i=new e.ICEGroup({left:0,top:0,width:t.width,height:t.height,origin:"top-left",fill:!1,stroke:!1,interactive:!1,draggable:!1,transformable:!1,linkable:!1,zIndex:Pe});return this.root.addChild(i),this.markLayer=i,i}},{key:"markHandle",value:function markHandle(e){var t=this,i={id:e.id,spec:e.spec,component:e.component,update:function update(r){return Object.assign(e.spec,r),t.syncMarks(),i},toData:function toData(){return t.markDataAt(e)},remove:function remove(){t.removeMark(e.id)}};return i}},{key:"markAxis",value:function markAxis(e){if(e.seriesId){var t=this.norm.series.find(function(t){return t.id===e.seriesId||t.name===e.seriesId});if(t)return this.norm.yAxes[t.axisIndex]||this.norm.yAxis}return this.norm.yAxes[0]||this.norm.yAxis}},{key:"markBox",value:function markBox(e,t){var i=e.type||"point",r=this.layout.plot,n=this.norm.xAxis.scale,a=this.markAxis(e),o=a&&a.scale,s=Number(e.dx)||0,l=Number(e.dy)||0,h=function px(e){return r.x+Number(n.map(e))+s},u=function py(e){return r.y+Number(o.map(e))+l},c=t.width||1,d=t.height||1;if("xLine"===i)return{left:h(e.x)-c/2,top:r.y+l,width:c,height:r.height};if("yLine"===i)return{left:r.x+s,top:u(e.y)-d/2,width:r.width,height:d};if("xBand"===i){var f=h(e.x0),p=h(e.x1);return{left:Math.min(f,p),top:r.y+l,width:Math.abs(p-f),height:r.height}}if("yBand"===i){var v=u(e.y0),m=u(e.y1);return{left:r.x+s,top:Math.min(v,m),width:r.width,height:Math.abs(m-v)}}var g=h(e.x),b=u(e.y);return{left:g-c/2,top:b-d/2,width:c,height:d,anchor:[g,b]}}},{key:"markDataAt",value:function markDataAt(e,t){var i,r,n=e.spec,a=n.type||"point",o=this.layout.plot,s=this.norm.xAxis.scale,l=this.markAxis(n),h=l&&l.scale,u=e.component.state||{},c=u.width||0,d=u.height||0,f=t?t.left:u.left,p=t?t.top:u.top;"point"===a?(i=f+c/2,r=p+d/2):"xLine"===a||"xBand"===a?(i=f+c/2,r=o.y+o.height/2):(i=o.x+o.width/2,r=p+d/2);var v=s&&"function"==typeof s.invert?s.invert(i-o.x):null,m=h&&"function"==typeof h.invert?Number(h.invert(r-o.y)):NaN;return{id:e.id,xValue:v,yValue:"xLine"!==a&&"xBand"!==a&&isFinite(m)?m:void 0,pixel:[i,r]}}},{key:"syncMarks",value:function syncMarks(){if(this.marks.length&&this.norm&&this.layout){var e=this.layout.plot;this.syncingMarks=!0;try{var t,i=_createForOfIteratorHelper(this.marks);try{for(i.s();!(t=i.n()).done;){var r=t.value,n=r.component.state||{},a=this.markBox(r.spec,{width:n.width||0,height:n.height||0});if([a.left,a.top,a.width,a.height].every(function(e){return isFinite(e)})){var o=!1!==r.spec.hideWhenOutOfView,s=a.anchor||[a.left+a.width/2,a.top+a.height/2],l=!(isFinite(s[0])&&isFinite(s[1]))||s[0]<e.x-a.width||s[0]>e.x+e.width+a.width||s[1]<e.y-a.height||s[1]>e.y+e.height+a.height,h=Math.round(a.left),u=Math.round(a.top),c=Math.max(1,Math.round(a.width)),d=Math.max(1,Math.round(a.height));n.left===h&&n.top===u||(r.component.setPosition(h,u),!0),n.width===c&&n.height===d||(r.component.setState({width:c,height:d}),!0),r.component.setState({display:!o||!l})}else r.component.setState({display:!1})}}catch(e){i.e(e)}finally{i.f()}}finally{this.syncingMarks=!1}this.markLayer&&this.markLayer.setState({width:this.layout.canvas.width,height:this.layout.canvas.height})}}},{key:"resetZoom",value:function resetZoom(){return this.viewState={x:null,y:null,yAxes:[]},this.rebuild(!0),this.emit("zoom:change",this.currentRange()),this}},{key:"toggleSeries",value:function toggleSeries(e,t){var i=this.norm.series.find(function(t){return t.id===e});if(!i)return this;var r=!!this.hiddenIds[e],n=void 0===t?!r:!t;return this.hiddenIds[e]=n,this.applyOption(this.option,{animate:!0,preserveView:!0}),this.emit("legend:toggle",{seriesId:e,seriesName:i.name,seriesIndex:i.index,selected:!n}),this}},{key:"isSeriesSelected",value:function isSeriesSelected(e){return!this.hiddenIds[e]}},{key:"toggleSlice",value:function toggleSlice(e,t,i){var r=this.norm.series.find(function(t){return t.id===e});if(!r||"pie"!==r.type&&"funnel"!==r.type)return this;var n="".concat(e,"#").concat(t),a=!!this.hiddenSlices[n],o=void 0===i?!a:!i;this.hiddenSlices[n]=o;var s=r.points[t];return this.applyOption(this.option,{animate:!0,preserveView:!0}),this.emit("legend:toggle",{seriesId:e,seriesName:s&&s.name||"".concat(r.name," ").concat(t+1),seriesIndex:r.index,selected:!o,dataIndex:t}),this}},{key:"showHoverAt",value:function showHoverAt(e,t){var i=this.norm.series.find(function(t){return t.id===e});if(!i)return this;var r=this.controller.resolver.buildActiveItem(i,t);return r&&this.controller.setHover({kind:"item",item:r}),this}},{key:"showHoverAtValue",value:function showHoverAtValue(e){return this.controller.showHoverAtValue(e),this}},{key:"clearHover",value:function clearHover(){return this.controller.clearHover(),this}},{key:"getSelection",value:function getSelection(){return this.controller.getSelectedParams()}},{key:"clearSelection",value:function clearSelection(){return this.controller.clearSelection(),this}},{key:"getDomain",value:function getDomain(e){return"x"===e?this.norm.xAxis.domain.slice():this.norm.yAxis.domain.slice()}},{key:"getAxisDomain",value:function getAxisDomain(e){var t=this.norm.yAxes[e];return t?t.domain.slice():this.norm.yAxis.domain.slice()}},{key:"setAxisDomain",value:function setAxisDomain(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"api";if(0===e)return this.setDomain("y",t,i);if(this.destroyed)return this;var r=this.clampAxisDomain(e,t);return r?(this.viewState.yAxes[e]=r,this.rebuild(!1),this.emit("pan"===i?"pan:change":"zoom:change",this.currentRange()),this):this}},{key:"fullDomain",value:function fullDomain(e){return("x"===e?this.fullXDomain:this.fullYDomain).slice()}},{key:"canvasElement",get:function get(){return this.canvasEl}},{key:"getDataTable",value:function getDataTable(){return buildDataTable(this)}},{key:"getA11yTree",value:function getA11yTree(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="function"==typeof this.ice.getAccessibilityTree?this.ice.getAccessibilityTree():[];return[].concat(_toConsumableArray(t),_toConsumableArray(buildDataNodes(this,e)))}},{key:"attachA11yMirror",value:function attachA11yMirror(){return this.a11yMirror.attach()}},{key:"detachA11yMirror",value:function detachA11yMirror(){this.a11yMirror.detach()}},{key:"a11yMirrorAttached",get:function get(){return this.a11yMirror.attached}},{key:"announceA11y",value:function announceA11y(e){this.a11yMirror.announce(e)}},{key:"on",value:function on(e,t,i){return this.emitter.on(e,t,i),this}},{key:"once",value:function once(e,t,i){return this.emitter.once(e,t,i),this}},{key:"off",value:function off(e,t,i){return this.emitter.off(e,t,i),this}},{key:"emit",value:function emit(e,t){return!(this.silenceDepth>0)&&this.emitter.emit(e,t)}},{key:"silent",value:function silent(e){this.silenceDepth++;try{return e()}finally{this.silenceDepth--}}},{key:"resize",value:function resize(e,t){if(this.destroyed)return this;var i=this.ice.dpr||1,r=this.canvasEl,n=e,a=t;if(void 0===n||void 0===a){var o=r&&"function"==typeof r.getBoundingClientRect?r.getBoundingClientRect():null;n=o&&o.width||r.width/i,a=o&&o.height||r.height/i}var s=Number(n),l=Number(a);return s>0&&l>0?(r.width=Math.round(s*i),r.height=Math.round(l*i),r.style&&(r.style.width="".concat(s,"px"),r.style.height="".concat(l,"px")),this.ice.canvasWidth=r.width,this.ice.canvasHeight=r.height,"function"==typeof this.ice.updateCanvasBoundingRect&&this.ice.updateCanvasBoundingRect(),this.rebuild(!1),this):this}},{key:"destroy",value:function destroy(){this.destroyed||(this.destroyed=!0,this.__offThemeFollow&&(this.__offThemeFollow(),this.__offThemeFollow=null),this.stopDomainTransition(),this.a11yMirror.detach(),this.controller.destroy(),this.resizeObserver&&"function"==typeof this.resizeObserver.disconnect&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.emitter.clear(),this.ice.destroy())}},{key:"nextFrame",value:function nextFrame(){var e=this;return new Promise(function(t){var i=e.ice.evtBus;if(i){var r=function handler(){i.off("ROUND_FINISH",r,null),t()};i.on("ROUND_FINISH",r,null),e.ice.dirty=!0}else t()})}},{key:"render",value:function render(){return this.ice.dirty=!0,this.nextFrame()}},{key:"formatAxisValue",value:function formatAxisValue(e,t){var i="x"===e?this.norm.xAxis:this.norm.yAxis,r=i.scale;if(!r)return String(t);var n=i.domain.indexOf(t);return formatTick(t,r,n<0?0:n,i.option.formatter)}},{key:"toDataURL",value:function toDataURL(e,t){return this.ice&&"function"==typeof this.ice.toDataURL?this.ice.toDataURL(e,t):""}},{key:"toBlob",value:function toBlob(e,t,i){this.ice&&"function"==typeof this.ice.toBlob?this.ice.toBlob(e,t,i):e(null)}},{key:"toJSON",value:function toJSON(){return{version:1,option:toSerializableOption(this.option),view:{x:this.viewState.x,y:this.viewState.y,yAxes:this.viewState.yAxes},hidden:_objectSpread2({},this.hiddenIds),hiddenSlices:_objectSpread2({},this.hiddenSlices)}}},{key:"toJSONString",value:function toJSONString(){return JSON.stringify(this.toJSON())}},{key:"fromJSONString",value:function fromJSONString(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=JSON.parse(e);return this.loadSnapshot(i,t),this}},{key:"fromJSONObject",value:function fromJSONObject(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.loadSnapshot(e,t),this}},{key:"loadSnapshot",value:function loadSnapshot(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){var i="string"==typeof e?JSON.parse(e):e,r=i.option||i;if("number"==typeof i.version&&i.version>1)throw new Error("[ice-chart] 快照版本 ".concat(i.version," 高于当前实现支持的 ").concat(1,",请升级 ice-chart 后再还原。"));var n=t.optionPatch?mergeOptionPatch(r,t.optionPatch):r;this.hiddenIds=i.hidden||{},this.hiddenSlices=i.hiddenSlices||{};var a=i.view||{};this.viewState={x:a.x||null,y:a.y||null,yAxes:a.yAxes||[]},this.applyOption(n,{animate:!1,preserveView:!0})}}},{key:"applyOption",value:function applyOption(e,t){this.option=e;var i=this.norm?this.norm.yAxis.domain.slice():null,r=normalizeOption(e,{hiddenIds:this.hiddenIds,hiddenSlices:this.hiddenSlices,preferDark:isEngineThemeDark(this.ice)});if("auto"!==e.theme){var n=JSON.stringify(r.theme);n!==this.__appliedEngineThemeKey&&(applyChartThemeToEngine(this.ice,r.theme),this.__appliedEngineThemeKey=n)}if(this.fullXDomain=r.xAxis.domain.slice(),this.fullYDomain=r.yAxis.domain.slice(),this.fullYDomains=r.yAxes.map(function(e){return e.domain.slice()}),this.autoYCurve=(e.series||[]).some(function(e){return!!e&&"function"===e.type}),!t.preserveView){this.viewState={x:null,y:null,yAxes:[]};var a=this.initialWindow(r);a&&(this.viewState.x=a)}if(this.hiddenIds=r.hiddenIds,this.hiddenSlices=r.hiddenSlices,this.rebuild("enter"===t.animate?"enter":!1!==t.animate&&"update"),"update"===("enter"===t.animate?"enter":!1!==t.animate&&"update")&&shouldAnimate()&&i&&this.norm&&"cartesian"===this.norm.kind&&2===this.norm.yAxis.domain.length){var o=this.norm.yAxis.domain;(Math.abs(Number(i[0])-Number(o[0]))>1e-9||Math.abs(Number(i[1])-Number(o[1]))>1e-9)&&this.startDomainTransition([Number(i[0]),Number(i[1])],[Number(o[0]),Number(o[1])])}}},{key:"initialWindow",value:function initialWindow(e){var t=e.option.dataZoom;if(!t||void 0===t.start&&void 0===t.end)return null;var i=clamp$2(Number(void 0===t.start?0:t.start)/100,0,1),r=clamp$2(Number(void 0===t.end?100:t.end)/100,0,1);if(i<=0&&r>=1)return null;var n=e.xAxis.domain;if("category"===e.xAxis.type){var a=n.length,o=clamp$2(Math.floor(i*a),0,Math.max(0,a-2)),s=clamp$2(Math.ceil(r*a)-1,o+1,a-1);return[n[o],n[s]]}var l=Number(n[0]),h=Number(n[1])-l;return[l+h*i,l+h*r]}},{key:"startDomainTransition",value:function startDomainTransition(e,t){var i=this;if(this.domainTransition={from:e,to:t},!this.domainFrameHandler){var r=this.ice.evtBus;r&&(this.domainFrameHandler=function(){return i.stepDomainTransition()},r.on("ICE_FRAME_EVENT",this.domainFrameHandler,this))}}},{key:"stepDomainTransition",value:function stepDomainTransition(){var e=this.domainTransition;if(e&&!this.destroyed){var t,i=0,r=_createForOfIteratorHelper(this.seriesComponents);try{for(r.s();!(t=r.n()).done;){var n=t.value,a=Number(n.state.progress);isFinite(a)&&a>i&&(i=a)}}catch(e){r.e(e)}finally{r.f()}if(i>=1)return this.domainTransition=null,this.stopDomainTransition(),void this.rebuild(!1);var o=e.to.map(function(t,r){var n=e.from[r];return isFinite(n)?n+(t-n)*i:t});this.rebuild(!1,o)}else this.stopDomainTransition()}},{key:"stopDomainTransition",value:function stopDomainTransition(){if(this.domainFrameHandler){var e=this.ice&&this.ice.evtBus;e&&e.off("ICE_FRAME_EVENT",this.domainFrameHandler,this),this.domainFrameHandler=null}}},{key:"rebuild",value:function rebuild(e,t){var i=this;if(!this.destroyed){var r=this.canvasRect(),n=this.viewState.x||this.fullXDomain,a=this.fullYDomains.map(function(e,t){var r=0===t?i.viewState.y:i.viewState.yAxes[t];return r&&2===r.length?r:e}),o=normalizeOption(this.option,{hiddenIds:this.hiddenIds,hiddenSlices:this.hiddenSlices,preferDark:isEngineThemeDark(this.ice),xDomain:n&&2===n.length?[n[0],n[1]]:null,yDomain:!this.autoYCurve||this.viewState.y||t&&2===t.length?t&&2===t.length?[Number(t[0]),Number(t[1])]:a[0]&&2===a[0].length?[Number(a[0][0]),Number(a[0][1])]:null:null,yDomains:a.map(function(e){return(!i.autoYCurve||i.viewState.y||t&&2===t.length)&&e&&2===e.length?[Number(e[0]),Number(e[1])]:null})});this.norm=o,this.autoYCurve&&(this.fullYDomain=o.yAxis.domain.slice(),this.fullYDomains=o.yAxes.map(function(e){return e.domain.slice()})),this.layout=computeLayout(o,this.ice.ctx,r),this.buildScales(o),this.root.state.ariaLabel=chartTitle(o),this.syncComponents(!t&&e),this.syncMarks(),this.ice.dirty=!0,this.controller&&this.controller.refreshHover(),this.a11yMirror.attached&&this.a11yMirror.refresh()}}},{key:"buildScales",value:function buildScales(e){var t=this.layout.plot;e.xAxis.scale=createScale(e.xAxis.type,e.xAxis.domain,[0,Math.max(1,t.width)],{logBase:e.xAxis.option.logBase});var i,r=_createForOfIteratorHelper(e.yAxes);try{for(r.s();!(i=r.n()).done;){var n=i.value;n.scale=createScale(n.type,n.domain,[Math.max(1,t.height),0],{logBase:n.option.logBase})}}catch(e){r.e(e)}finally{r.f()}}},{key:"syncComponents",value:function syncComponents(e){var t=this.norm,i=this.layout,r=i.canvas,n=i.plot,a=t.theme;this.root.state.width===r.width&&this.root.state.height===r.height||this.root.setState({width:r.width,height:r.height});var o=i.polar,s="cartesian"!==t.kind;this.plotArea.setState({left:n.x,top:n.y,width:n.width,height:n.height}),this.plotArea.setBackground("transparent"===a.backgroundColor?null:a.backgroundColor),this.grid.setState({width:r.width,height:r.height}),this.grid.setState({display:!s}),this.grid.xScale=t.xAxis.scale,this.grid.yScale=t.yAxis.scale,this.grid.horizontal=t.yAxes.map(function(e,t){return{axis:e,axisLayout:i.yAxes[t],index:t}}).filter(function(e){return void 0===e.axis.option.showGrid?0===e.index:!1!==e.axis.option.showGrid}).map(function(e){return{scale:e.axis.scale,ticks:e.axisLayout.ticks,index:e.index}}),this.grid.plot=n,this.grid.grid=t.option.grid||{},this.grid.theme=a,this.grid.markDirty(),this.radarGrid.setState({width:r.width,height:r.height,display:"radar"===t.kind}),this.radarGrid.theme=a,this.radarGrid.coord="radar"===t.kind&&o&&t.radar?{polar:o,plot:n,indicators:t.radar.indicators.map(function(e,i){return{name:e.name,max:t.radarDomains[i]?t.radarDomains[i][1]:1}}),shape:t.radar.shape||"polygon",splitNumber:Math.max(1,Number(t.radar.splitNumber)||4)}:null,this.radarGrid.markDirty();var l=t.option.polarGrid,h="cartesian"===t.kind&&!!l&&"equal"===t.option.aspect;this.polarGrid.setState({width:r.width,height:r.height,display:h}),this.polarGrid.theme=a,this.polarGrid.layout=i,this.polarGrid.coord=h?{plot:n,xScale:t.xAxis.scale,yScale:t.yAxis.scale,options:!0===l?{}:l}:null,this.polarGrid.markDirty(),this.syncAxisComponents();for(var u=0;u<this.axisYList.length;u++){var c=this.axisYList[u];c.setState({width:r.width,height:r.height,display:!s}),c.layout=i,c.theme=a,c.axis=t.yAxes[u]||t.yAxis,c.axisIndex=u,c.position=t.yAxes[u]&&t.yAxes[u].position||"left",c.syncTicks(),c.markDirty()}var d=this.axisX;d.setState({width:r.width,height:r.height,display:!s}),d.layout=i,d.theme=a,d.axis=t.xAxis,d.syncTicks(),d.markDirty(),this.grid.axisX=this.axisX,this.grid.axisYList=this.axisYList,this.grid.syncTicks(),this.annotation.setState({width:r.width,height:r.height,display:!0}),this.annotation.plot=n,this.annotation.xAxis=t.xAxis,this.annotation.yAxes=t.yAxes,this.annotation.sync(t.option.annotation,{kind:t.kind,plot:n,xAxis:t.xAxis,yAxes:t.yAxes,theme:a}),this.legend&&(this.legend.setState({width:r.width,height:r.height}),this.legend.layout=i,this.legend.theme=a,this.legend.selectable=!1!==t.option.legend.selectable,this.legend.markDirty()),this.titleComponent&&(this.titleComponent.setState({width:r.width,height:r.height}),this.titleComponent.layout=i,this.titleComponent.theme=a,this.titleComponent.markDirty());for(var f=0,p=[this.crosshair,this.highlight,this.brushComponent,this.tooltip];f<p.length;f++){var v=p[f];v&&(v.setState({width:r.width,height:r.height}),v.theme=a,v.markDirty())}if(this.tooltip&&(this.tooltip.layout=i),this.crosshair){this.crosshair.layout=i,this.crosshair.option=t.option.crosshair||{};var m=Number(this.crosshair.option.followDuration);this.crosshair.followDuration=isFinite(m)&&m>=0?Math.min(400,m):90}if(this.crosshair&&this.crosshair.setState({display:!s}),this.brushComponent){var g=t.option.interaction&&t.option.interaction.brush;this.brushComponent.color=g&&!1!==g&&g.color?{fill:toAlpha(g.color,.16),stroke:g.color}:null}if(this.dataZoomSlider){var b=i.slider;if(b){this.dataZoomSlider.setState({left:b.x,top:b.y,width:b.width,height:b.height,display:!0});var k=_slicedToArray(this.domainFractions(),2),S=k[0],w=k[1];this.dataZoomSlider.setWindow(S,w)}else this.dataZoomSlider.setState({display:!1});this.dataZoomSlider.theme=a,this.dataZoomSlider.markDirty()}this.syncSeries(e)}},{key:"domainFractions",value:function domainFractions(){var e=this.fullXDomain,t=this.norm.xAxis.domain;if(!e||e.length<2||!t||t.length<2)return[0,1];if("category"===this.norm.xAxis.type){var i=e.length;if(i<=1)return[0,1];var r=Math.max(0,e.indexOf(t[0])),n=e.indexOf(t[t.length-1]);return[r/i,((n<0?i-1:n)+1)/i]}var a=Number(e[0]),o=Number(e[1])-a||1;return[(Number(t[0])-a)/o,(Number(t[1])-a)/o]}},{key:"setDomainFromFractions",value:function setDomainFromFractions(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"slider",r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("cartesian"!==this.norm.kind)return this;var n=_slicedToArray(this.domainFractions(),2),a=n[0],o=n[1];if(Math.abs(a-e)<1e-4&&Math.abs(o-t)<1e-4)return this;var s=this.fullXDomain;if("category"===this.norm.xAxis.type){var l=s.length;if(l<2)return this;var h=Math.round(e*l),u=Math.round(t*l)-1;h=Math.max(0,Math.min(l-1,h)),(u=Math.max(0,Math.min(l-1,u)))<=h&&(u=Math.min(l-1,h+1));var c=[s[h],s[u]];return this.setDomain("x",r?this.guardInteractiveXWindow(c):c,i)}var d=Number(s[0]),f=Number(s[1])-d,p=[d+f*e,d+f*t];return this.setDomain("x",r?this.guardInteractiveXWindow(p):p,i)}},{key:"syncAxisComponents",value:function syncAxisComponents(){var e=this.norm.yAxes,t=e.length,i=e.map(function(e){return e.position}).join("|");if(this.axisSignature!==i){var r,n=_createForOfIteratorHelper(this.axisYList);try{for(n.s();!(r=n.n()).done;){var a=r.value;this.root.removeChild(a)}}catch(e){n.e(e)}finally{n.f()}var o=this.layout.canvas;this.axisYList=e.map(function(e,t){return new N({orientation:"y",width:o.width,height:o.height,zIndex:Ie+t,axisIndex:t,position:e.position})}),this.root.addChildren(this.axisYList),this.axisSignature=i}for(;this.axisYList.length>t;){var s=this.axisYList.pop();this.root.removeChild(s)}}},{key:"syncSeries",value:function syncSeries(e){var t=this.norm,i=this.layout.plot,r=t.series.map(function(e){return"".concat(e.id,":").concat(e.type)}).join("|"),n=computeBarSlots(t.series);if(r!==this.seriesSignature){var a,o=_createForOfIteratorHelper(this.seriesComponents);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.root.removeChild(s)}}catch(e){o.e(e)}finally{o.f()}this.seriesComponents=t.series.map(function(e,t){return createSeriesComponent(e,{left:i.x,top:i.y,width:i.width,height:i.height,zIndex:Te+t})}),this.root.addChildren(this.seriesComponents),this.seriesSignature=r}for(var l=0;l<this.seriesComponents.length;l++){var h=this.seriesComponents[l],u=t.series[l],c=!u.hidden,d=t.yAxes[u.axisIndex]||t.yAxis,f=this.layout.polar,p="pie"===u.type?{polar:f,plot:i,canvas:this.layout.canvas}:"radar"===u.type?{polar:f,plot:i,canvas:this.layout.canvas,domains:t.radarDomains}:"funnel"===u.type?{plot:i,canvas:this.layout.canvas,options:t.funnel||{}}:"gauge"===u.type?{polar:f,plot:i,canvas:this.layout.canvas,options:t.gauge||{}}:"liquid"===u.type?{polar:f,plot:i,canvas:this.layout.canvas,options:t.liquid||{}}:"treemap"===u.type?{plot:i,canvas:this.layout.canvas,layout:layoutTreemap(u.option.data||[],i,t.treemap||{},t.theme.colorPalette),options:t.treemap||{}}:"graph"===u.type&&t.graph?{plot:i,canvas:this.layout.canvas,layout:forceLayout(t.graph.nodes||[],t.graph.links||[],i,t.graph,t.theme.colorPalette),options:t.graph}:"sankey"===u.type&&t.sankey?{plot:i,canvas:this.layout.canvas,layout:layoutSankey(t.sankey.nodes||[],t.sankey.links||[],i,t.sankey,t.theme.colorPalette),options:t.sankey}:{plot:i,canvas:this.layout.canvas,xScale:t.xAxis.scale,yScale:d.scale,yAxisIndex:u.axisIndex,theme:t.theme};if(h.setState({left:i.x,top:i.y,width:i.width,height:i.height,display:c,zIndex:Te+l,interactive:c}),h.barSlot=n[u.id]||{index:0,count:1},h.chartTheme=t.theme,h.state.ariaLabel="".concat(u.name," 系列,共 ").concat(u.points.length," 个数据点"),h.updateSeries(u,!!e&&!this.viewState.x,!!this.domainTransition),"pie"!==u.type&&"funnel"!==u.type||h.setHiddenSlices(hiddenSliceIndexes(t,u.id)),h.setCoord(p),h.markDirty(),e&&c){var v=t.option.animation;if(v&&!1!==v.enabled){var m=v["enter"===e?"enter":"update"];m&&this.playStage(h,_objectSpread2(_objectSpread2({},m),{},{kind:"enter"===e?"enter":"update"}))}}}}},{key:"playStage",value:function playStage(e,t){if(!shouldAnimate())return e.setAnimationStage(t),e.setState({progress:1}),void e.markDirty();e.setAnimationStage(t);var i=_objectSpread2({},e.props.animations||{});i.progress={from:0,to:1,duration:Math.max(1,Number(t.duration)||480),delay:Number(t.delay)||0,easing:t.easing||"easeOutCubic",startTime:void 0,finished:!1},e.props.animations=i,e.setState({progress:0}),this.ice.animationManager&&this.ice.animationManager.add(e)}},{key:"playEnter",value:function playEnter(e,t,i){this.playStage(e,{duration:t,easing:i,stagger:0})}},{key:"finishAnimations",value:function finishAnimations(){this.domainTransition=null,this.stopDomainTransition();var e,t=_createForOfIteratorHelper([].concat(_toConsumableArray(this.seriesComponents),[this.axisX],_toConsumableArray(this.axisYList),[this.grid,this.tooltip,this.crosshair]));try{for(t.s();!(e=t.n()).done;){var i=e.value;if(i){var r=i.props.animations;if(r)for(var n in r)0!==n.indexOf("__")&&r[n]&&(r[n].finished=!0);var a=!!r&&Object.keys(r).some(function(e){return 0===e.indexOf("__")});this.ice.animationManager&&!a&&this.ice.animationManager.remove(i),i.props&&i.props.animations&&i.props.animations.axisMorph&&i.setState({axisMorph:1}),Number(i.state.progress)<1&&i.setState({progress:1}),i.markDirty()}}}catch(e){t.e(e)}finally{t.f()}return this.ice.dirty=!0,this}},{key:"currentRange",value:function currentRange(){return{x:[this.norm.xAxis.domain[0],this.norm.xAxis.domain[this.norm.xAxis.domain.length-1]],y:[Number(this.norm.yAxis.domain[0]),Number(this.norm.yAxis.domain[1])]}}},{key:"clampDomain",value:function clampDomain(e,t){return"y"===e?this.clampAxisDomain(0,t):this.clampAxisDomain(-1,t)}},{key:"clampAxisDomain",value:function clampAxisDomain(e,t){var i=e<0?this.fullXDomain:this.fullYDomains[e];if(!i||i.length<2||!t||t.length<2)return null;var r=e<0?this.norm.xAxis:this.norm.yAxes[e];if(!r)return null;if("category"===r.type){var n=i,a=n.indexOf(t[0]),o=n.indexOf(t[1]);if(a<0&&(a=0),o<0&&(o=n.length-1),a>o){var s=a;a=o,o=s}return o-a<1?null:[n[a],n[o]]}var l=Number(i[0]),h=Number(i[1]),u=Math.max(l,Number(t[0])),c=Math.min(h,Number(t[1]));return!isFinite(u)||!isFinite(c)||c<=u||c-u<.001*(h-l)?null:[u,c]}},{key:"canvasRect",value:function canvasRect(){var e=this.ice&&this.ice.dpr||1,t=(this.ice&&this.ice.canvasWidth?this.ice.canvasWidth:this.canvasEl?this.canvasEl.width:0)/e,i=(this.ice&&this.ice.canvasHeight?this.ice.canvasHeight:this.canvasEl?this.canvasEl.height:0)/e;return{x:0,y:0,width:Math.max(1,Math.round(t)),height:Math.max(1,Math.round(i))}}},{key:"observeResize",value:function observeResize(){var e=this,t="undefined"!=typeof window?window.ResizeObserver:null;if(t&&this.canvasEl){var i=this.canvasEl.parentNode||this.canvasEl;this.resizeObserver=new t(function(){e.resize()}),this.resizeObserver.observe(i)}}},{key:"registerTypes",value:function registerTypes(){for(var e=0,t=[["ice-chart:PlotArea",E],["ice-chart:GridLines",D],["ice-chart:Annotation",R],["ice-chart:Axis",N],["ice-chart:Legend",L],["ice-chart:Title",z],["ice-chart:Tooltip",B],["ice-chart:Crosshair",W],["ice-chart:Highlight",V],["ice-chart:Brush",j]];e<t.length;e++){var i=_slicedToArray(t[e],2),r=i[0],n=i[1];this.ice.registerType(r,n)}}}],[{key:"restore",value:function restore(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new ICEChart(e,i.initialOption||{series:[]},i.chartOptions);return r.fromJSONObject(t,i),r}}])}();function computeBarSlots(e){var t,i=[],r={},n=_createForOfIteratorHelper(e);try{var a=function _loop(){var e=t.value;if("bar"!==e.type||e.hidden)return 1;var r=e.option.stack?"stack:".concat(e.option.stack):"single:".concat(e.id),n=i.find(function(e){return e.key===r});n||(n={key:r,members:[]},i.push(n)),n.members.push(e)};for(n.s();!(t=n.n()).done;)a()}catch(e){n.e(e)}finally{n.f()}for(var o=0;o<i.length;o++){var s,l=_createForOfIteratorHelper(i[o].members);try{for(l.s();!(s=l.n()).done;){r[s.value.id]={index:o,count:i.length}}}catch(e){l.e(e)}finally{l.f()}}return r}function hiddenSliceIndexes(e,t){var i=[],r=e.series.find(function(e){return e.id===t});if(!r)return i;var n,a=_createForOfIteratorHelper(r.points);try{for(a.s();!(n=a.n()).done;){var o=n.value;e.hiddenSlices["".concat(t,"#").concat(o.index)]&&i.push(o.index)}}catch(e){a.e(e)}finally{a.f()}return i}function isEngineThemeDark(e){try{var t=function parseHexColor(e){if("string"!=typeof e)return null;var t=e.trim();if("#"!==t.charAt(0))return null;var i=t.slice(1);3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]);return 6!==i.length?null:[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16)]}(e&&e.getTheme&&e.getTheme().semantic.background);if(!t)return!1;var i=_slicedToArray(t.map(function(e){var t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}),3);return.2126*i[0]+.7152*i[1]+.0722*i[2]<.35}catch(e){return!1}}function toAlpha(e,t){if("string"!=typeof e)return"rgba(0,0,0,".concat(t,")");if(0===e.indexOf("#")){var i=e.slice(1);if(3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),6!==i.length)return e;var r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return"rgba(".concat(r,",").concat(n,",").concat(a,",").concat(t,")")}return 0===e.indexOf("rgb(")?e.replace("rgb(","rgba(").replace(")",",".concat(t,")")):e}function applyRange(e,t,i,r){if(("x"===r||"xy"===r)&&i.x){var n,a=_createForOfIteratorHelper(e);try{var o=function _loop4(){var e=n.value;e!==t&&e.silent(function(){return e.setDomain("x",i.x,"link")})};for(a.s();!(n=a.n()).done;)o()}catch(e){a.e(e)}finally{a.f()}}if(("y"===r||"xy"===r)&&i.y){var s,l=_createForOfIteratorHelper(e);try{var h=function _loop5(){var e=s.value;e!==t&&e.silent(function(){return e.setDomain("y",i.y,"link")})};for(l.s();!(s=l.n()).done;)h()}catch(e){l.e(e)}finally{l.f()}}}exports.A11yMirror=_e,exports.Annotation=R,exports.AreaSeries=$,exports.Axis=N,exports.BOOTSTRAP_CHART_THEME=n,exports.BOOTSTRAP_DARK_CHART_THEME=a,exports.BOOTSTRAP_TOKENS=i,exports.BandScale=T,exports.BarSeries=q,exports.BoxplotSeries=le,exports.Brush=j,exports.CandlestickSeries=te,exports.ChartComponent=I,exports.Crosshair=W,exports.CurveSeriesBase=de,exports.DARK_CHART_THEME=s,exports.DEFAULT_ANIMATION_STAGES=M,exports.Emitter=we,exports.ExpressionError=m,exports.FunctionSeries=fe,exports.FunnelSeries=ne,exports.GaugeSeries=se,exports.GraphSeries=ce,exports.GridLines=D,exports.HeatmapSeries=ie,exports.Highlight=V,exports.HitResolver=be,exports.ICEChart=Le,exports.InteractionController=Se,exports.LIGHT_CHART_THEME=o,exports.Legend=L,exports.LineSeries=Y,exports.LinearScale=C,exports.LiquidSeries=ye,exports.LogScale=P,exports.ParametricSeries=pe,exports.PieSeries=Q,exports.PlotArea=E,exports.RadarGrid=U,exports.RadarSeries=ee,exports.SERIES_ROLE_HINT={line:"趋势线",area:"面积趋势",bar:"柱形",scatter:"散点",pie:"扇形",radar:"雷达多边形",candlestick:"K 线",heatmap:"热力图单元",sankey:"桑基连线",funnel:"漏斗阶段",gauge:"仪表盘",liquid:"水位球",boxplot:"箱线图",waterfall:"瀑布柱",treemap:"矩形树图单元",graph:"关系图节点",function:"函数曲线",parametric:"参数曲线"},exports.SNAPSHOT_VERSION=1,exports.SankeySeries=re,exports.ScatterSeries=Z,exports.SeriesBase=G,exports.TimeScale=v,exports.Title=z,exports.Tooltip=B,exports.TreemapSeries=ue,exports.VISUALLY_HIDDEN_STYLE=Ae,exports.WaterfallSeries=he,exports.applyChartThemeToEngine=applyChartThemeToEngine,exports.buildDataNodes=buildDataNodes,exports.buildDataTable=buildDataTable,exports.chartThemeToEnginePatch=chartThemeToEnginePatch,exports.chartTitle=chartTitle,exports.clearCustomSeriesTypes=function clearCustomSeriesTypes(){for(var e=0,t=Object.keys(xe);e<t.length;e++){var i=t[e];delete xe[i]}},exports.compileExpression=compileExpression,exports.compileSampler=compileSampler,exports.computeBarSlots=computeBarSlots,exports.computeBoxplotSummary=computeBoxplotSummary,exports.computeLayout=computeLayout,exports.createChart=function createChart(e,t,i){return"string"==typeof t||isChartSnapshot(t)?Le.restore(e,t,{chartOptions:i}):new Le(e,t,i)},exports.createScale=createScale,exports.createSeriesComponent=createSeriesComponent,exports.diagnoseExpression=diagnoseExpression,exports.errorsOf=function errorsOf(e){return e.filter(function(e){return"error"===e.severity})},exports.evaluateExpression=function evaluateExpression(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return compileExpression(e).evaluate(t)},exports.forceLayout=forceLayout,exports.formatNumberTick=formatNumberTick,exports.formatTick=formatTick,exports.getMotionPreference=function getMotionPreference(){return O},exports.getSeriesTypeFactory=getSeriesTypeFactory,exports.isBuiltinSeriesType=function isBuiltinSeriesType(e){return Object.prototype.hasOwnProperty.call(me,e)},exports.isChartSnapshot=isChartSnapshot,exports.layoutSankey=layoutSankey,exports.layoutTreemap=layoutTreemap,exports.linkCharts=function linkCharts(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.axis||"x",n=!1!==i.hover,a=!1!==i.zoom,o=!1!==i.brush,s=[],l=_createForOfIteratorHelper(e);try{var h=function _loop(){var i=t.value,l=function onHover(t){if(n&&t){var r,a=_createForOfIteratorHelper(e);try{var o=function _loop2(){var e=r.value;e!==i&&e.silent(function(){return e.showHoverAtValue(t.xValue)})};for(a.s();!(r=a.n()).done;)o()}catch(e){a.e(e)}finally{a.f()}}},h=function onLeave(){if(n){var t,r=_createForOfIteratorHelper(e);try{var a=function _loop3(){var e=t.value;e!==i&&e.silent(function(){return e.clearHover()})};for(r.s();!(t=r.n()).done;)a()}catch(e){r.e(e)}finally{r.f()}}},u=function onZoom(t){a&&t&&applyRange(e,i,t,r)},c=function onPan(t){a&&t&&applyRange(e,i,t,r)},d=function onBrush(t){o&&t&&applyRange(e,i,t,r)};i.on("item:hover",l),i.on("item:leave",h),i.on("zoom:change",u),i.on("pan:change",c),i.on("brush:end",d),s.push(function(){i.off("item:hover",l),i.off("item:leave",h),i.off("zoom:change",u),i.off("pan:change",c),i.off("brush:end",d)})};for(l.s();!(t=l.n()).done;)h()}catch(e){l.e(e)}finally{l.f()}return{charts:e,unlink:function unlink(){for(var e=0,t=s;e<t.length;e++){(0,t[e])()}s.length=0}}},exports.listSeriesTypes=function listSeriesTypes(){return[].concat(_toConsumableArray(Object.keys(me)),_toConsumableArray(Object.keys(xe)))},exports.mergeOptionPatch=mergeOptionPatch,exports.mixColors=mixColors,exports.normalizeAnimation=normalizeAnimation,exports.normalizeAnnotation=normalizeAnnotation,exports.normalizeOption=normalizeOption,exports.registerSeriesType=function registerSeriesType(e,t){if("string"!=typeof e||!ge.test(e))throw new Error("[ice-chart] registerSeriesType:类型名必须是非空字符串(字母开头,可含数字 / 下划线 / 连字符),收到「".concat(String(e),"」"));if("function"!=typeof t)throw new Error("[ice-chart] registerSeriesType:factory 必须是函数");if(Object.prototype.hasOwnProperty.call(me,e))throw new Error("[ice-chart] registerSeriesType:「".concat(e,"」是内置类型,不能覆盖(会破坏 option 的跨端可复现性)"));var i=xe[e];if(i&&i!==t)throw new Error("[ice-chart] registerSeriesType:「".concat(e,"」已经注册过另一个工厂,先 unregisterSeriesType 再注册"));xe[e]=t},exports.resolveAnnotation=resolveAnnotation,exports.resolveChartTheme=resolveChartTheme,exports.robustRange=robustRange,exports.roundRect=roundRect,exports.sampleFunctionCurve=sampleFunctionCurve,exports.sampleGraphLink=sampleGraphLink,exports.sampleLinkPath=sampleLinkPath,exports.sampleParametricCurve=sampleParametricCurve,exports.setMotionPreference=function setMotionPreference(e){O=e},exports.shouldAnimate=shouldAnimate,exports.toSerializableOption=toSerializableOption,exports.unregisterSeriesType=function unregisterSeriesType(e){return!!Object.prototype.hasOwnProperty.call(xe,e)&&(delete xe[e],!0)},exports.warningsOf=function warningsOf(e){return e.filter(function(e){return"warning"===e.severity})};