@visactor/vrender-components 0.15.3 → 0.16.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/cjs/brush/brush.d.ts +0 -5
  2. package/cjs/brush/brush.js +14 -18
  3. package/cjs/brush/brush.js.map +1 -1
  4. package/cjs/brush/config.d.ts +0 -5
  5. package/cjs/brush/config.js +0 -5
  6. package/cjs/brush/config.js.map +1 -1
  7. package/cjs/brush/type.d.ts +1 -6
  8. package/cjs/brush/type.js.map +1 -1
  9. package/cjs/data-zoom/data-zoom.d.ts +0 -1
  10. package/cjs/data-zoom/data-zoom.js +3 -14
  11. package/cjs/data-zoom/data-zoom.js.map +1 -1
  12. package/cjs/index.d.ts +1 -1
  13. package/cjs/index.js +1 -1
  14. package/cjs/index.js.map +1 -1
  15. package/cjs/label/arc.js +12 -24
  16. package/cjs/label/arc.js.map +1 -1
  17. package/cjs/poptip/contribution.js +2 -2
  18. package/cjs/poptip/contribution.js.map +1 -1
  19. package/cjs/poptip/poptip-plugin.js +3 -3
  20. package/cjs/poptip/poptip-plugin.js.map +1 -1
  21. package/cjs/poptip/register.d.ts +1 -1
  22. package/cjs/poptip/register.js +2 -2
  23. package/cjs/poptip/register.js.map +1 -1
  24. package/dist/index.js +40 -98
  25. package/dist/index.min.js +1 -1
  26. package/es/brush/brush.d.ts +0 -5
  27. package/es/brush/brush.js +14 -17
  28. package/es/brush/brush.js.map +1 -1
  29. package/es/brush/config.d.ts +0 -5
  30. package/es/brush/config.js +0 -5
  31. package/es/brush/config.js.map +1 -1
  32. package/es/brush/type.d.ts +1 -6
  33. package/es/brush/type.js.map +1 -1
  34. package/es/data-zoom/data-zoom.d.ts +0 -1
  35. package/es/data-zoom/data-zoom.js +4 -15
  36. package/es/data-zoom/data-zoom.js.map +1 -1
  37. package/es/index.d.ts +1 -1
  38. package/es/index.js +1 -1
  39. package/es/index.js.map +1 -1
  40. package/es/label/arc.js +8 -20
  41. package/es/label/arc.js.map +1 -1
  42. package/es/poptip/contribution.js +1 -1
  43. package/es/poptip/contribution.js.map +1 -1
  44. package/es/poptip/poptip-plugin.js +1 -3
  45. package/es/poptip/poptip-plugin.js.map +1 -1
  46. package/es/poptip/register.d.ts +1 -1
  47. package/es/poptip/register.js +1 -3
  48. package/es/poptip/register.js.map +1 -1
  49. package/package.json +7 -6
package/dist/index.min.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@visactor/vrender"),require("@visactor/vutils"),require("@visactor/vscale")):"function"==typeof define&&define.amd?define(["exports","@visactor/vrender","@visactor/vutils","@visactor/vscale"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).VRender=t.VRender||{},t.VRender.Components={}),t.VRender,t.VUtils,t.VScale)}(this,(function(t,e,i,s){"use strict";const n=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class a extends e.Group{constructor(t,e="2d"){super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,s){!i.isPlainObject(this.attribute[t])||i.isFunction(this.attribute[t])||i.isFunction(e)?this.attribute[t]=e:i.merge(this.attribute[t],e),n.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!s&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>n.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){i.isNil(e)&&(e=Object.keys(t));for(let s=0;s<e.length;s++){const n=e[s];!i.isPlainObject(this.attribute[n])||i.isFunction(this.attribute[n])||i.isFunction(t[n])?this.attribute[n]=t[n]:i.merge(this.attribute[n],t[n])}}bindEvents(){}_getNodeId(t){return`${this.id}-${this.name}-${t}`}}class r extends a{constructor(t){super(i.merge({},r.defaultAttributes,t)),this.name="scrollbar",this._onRailPointerDown=t=>{var e,s;const{viewX:n,viewY:a}=t,{direction:r,width:l,height:o,range:d}=this.attribute,h=this._sliderSize,[u,c]=this._getScrollRange();let b;if("vertical"===r){const t=a-this._viewPosition.y,e=i.clamp(t-h/2,u,c);b=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=i.clamp(t-h/2,u,c);b=t/l,this._slider.setAttribute("x",e,!0)}this.setScrollRange([b-(d[1]-d[0])/2,b+(d[1]-d[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(s=this.stage)||void 0===s||s.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:i}=this.attribute;this._prePos="horizontal"===i?t.clientX:t.clientY,"browser"===e.vglobal.env?(e.vglobal.addEventListener("pointermove",this._onSliderPointerMove),e.vglobal.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,s,n=0;const a=this.getScrollRange(),{width:r,height:l}=this._getSliderRenderBounds();"vertical"===e?(s=t.clientY,n=s-this._prePos,i=n/l):(s=t.clientX,n=s-this._prePos,i=n/r),this.setScrollRange([a[0]+i,a[1]+i],!0),this._prePos=s},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===e.vglobal.env?(e.vglobal.removeEventListener("pointermove",this._onSliderPointerMove),e.vglobal.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t,e=!0){var s,n;const{direction:a="horizontal",limitRange:r=[0,1],range:l}=this.attribute,o=i.clampRange(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===a?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(s=this.stage)||void 0===s?void 0:s.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:l,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:s,range:n,limitRange:a=[0,1],railStyle:r,sliderStyle:l,padding:o=2}=this.attribute,d=this.createOrUpdateChild("scrollbar-container",{},"group"),h=d.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:s},r),"rect");this._rail=h;const u=this._getSliderRenderBounds(),c=this._getSliderPos(i.clampRange(n,a[0],a[1])),b=c[1]-c[0];let g;this._sliderSize=b,g="horizontal"===t?{x:c[0],y:u.y1,width:b,height:u.height}:{x:u.x1,y:c[0],width:u.width,height:b};const p=d.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},g),{cornerRadius:this._getDefaultSliderCornerRadius()}),l),{boundsPadding:i.normalizePadding(o),pickMode:"imprecise"}),"rect");this._slider=p,this._container=d;const v=this._container.AABBBounds;this._viewPosition={x:v.x1,y:v.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:s=2}=this.attribute,[n,a,r,l]=i.normalizePadding(s),o={x1:l,y1:n,x2:t-a,y2:e-r,width:t-(l+a),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:a}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+a,s*t[1]+a]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[s,n]=i.clampRange(t,0,1),{width:a,height:r,x1:l,y1:o}=this._getSliderRenderBounds(),d=this._sliderSize;return"horizontal"===e?i.clampRange([l+s*a,l+n*a],l,a-d):i.clampRange([o+s*r,o+n*r],o,r-d)}_onChange(t){var i;const s=new e.CustomEvent("scroll",t);s.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(s)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function o(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i}function d(t,e,i,s){var n,a=arguments.length,r=a<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"===("undefined"==typeof Reflect?"undefined":l(Reflect))&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(r=(a<3?n(r):a>3?n(e,i,r):n(e,i))||r);return a>3&&r&&Object.defineProperty(e,i,r),r}function h(t,e,i,s){return new(i||(i=Promise))((function(n,a){function r(t){try{o(s.next(t))}catch(t){a(t)}}function l(t){try{o(s.throw(t))}catch(t){a(t)}}function o(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,l)}o((s=s.apply(t,e||[])).next())}))}function u(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&u(t,e)}))}r.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]},"function"==typeof SuppressedError&&SuppressedError;const c=t=>!i.isNil(t)&&!1!==t.visible;const b=["#ffffff","#000000"];function g(t,e,i,s,n){const a=_(t),r=_(e);return p(a,r,i,s)?a:function(t,e,i,s,n){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n));a.push(...b);for(const n of a)if(t!==n&&p(n,e,i,s))return n;return}(a,r,i,s,n)}function p(t,e,i,s){return s?v(t,e)>s:"largeText"===i?v(t,e)>3:v(t,e)>4.5}function v(t,e){const i=m(t),s=m(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function m(t){const e=i.ColorUtil.hexToRgb(t),s=e[0]/255,n=e[1]/255,a=e[2]/255;let r,l,o;r=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),l=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4);return.2126*r+.7152*l+.0722*o}function _(t){if(null==t?void 0:t.includes("#"))return t;const e=new i.ColorUtil.Color(t),{r:s,g:n,b:a}=e.color;return"#"+i.ColorUtil.rgbToHex(s,n,a)}function y(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function x(t,e){return[t[0]*e,t[1]*e]}function f(t,e,i){const s=function(t,e){const[i,s]=t,[n,a]=e,r=Math.sqrt((i*i+s*s)*(n*n+a*a)),l=r&&(i*n+s*a)/r;return Math.acos(Math.min(Math.max(l,-1),1))}(t,e),n=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const A=-.5*Math.PI,S=1.5*Math.PI,E="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var L;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(L||(L={}));const k={[L.selectedReverse]:{},[L.selected]:{},[L.hover]:{},[L.hoverReverse]:{}},M=(t,s,n)=>new i.TextMeasure(Object.assign({defaultFontParams:{fontFamily:E,fontSize:11},getTextBounds:n?void 0:e.getTextBounds,specialCharSet:"-/: .,@%'\"~"+i.TextMeasure.ALPHABET_CHAR_SET+i.TextMeasure.ALPHABET_CHAR_SET.toUpperCase()},null!=s?s:{}),t);function B(t,i){var s;if(!t)return{width:0,height:0};const n=e.getTextBounds({text:t,fontFamily:i.fontFamily,fontSize:i.fontSize||12,fontWeight:i.fontWeight,textAlign:null!==(s=i.textAlign)&&void 0!==s?s:"center",textBaseline:i.textBaseline,ellipsis:!!i.ellipsis,maxLineWidth:i.maxLineWidth||1/0,lineHeight:i.fontSize||12});return{width:n.width(),height:n.height()}}class w extends a{constructor(t){super(i.merge({},w.defaultAttributes,t)),this.name="tag"}render(){var t;const{text:e="",textStyle:s={},shape:n={},panel:a={},space:r=4,minWidth:l,maxWidth:d,padding:h=4,visible:u,state:c}=this.attribute,b=i.normalizePadding(h),g=this.createOrUpdateChild("tag-content",{x:0,y:0,zIndex:1},"group");let p,v=b[1]+b[3],m=b[0]+b[2],_=0,y=0;const{visible:x}=n,f=o(n,["visible"]);if(i.isBoolean(x)){const t=(null==f?void 0:f.size)||10,e=i.isNumber(t)?t:Math.max(t[0],t[1]);p=g.createOrUpdateChild("tag-shape",Object.assign(Object.assign({symbolType:"circle",size:t,strokeBoundsBuffer:0},f),{visible:x,x:e/2,y:e/2}),"symbol"),i.isEmpty(null==c?void 0:c.shape)||(p.states=c.shape),x&&(y=e+r)}v+=y,_+=y;const A=Object.assign(Object.assign({text:e,visible:i.isValid(e)&&!1!==u,lineHeight:null==s?void 0:s.fontSize},s),{x:_,y:0});i.isNil(A.lineHeight)&&(A.lineHeight=A.fontSize);const S=g.createOrUpdateChild("tag-text",A,"text");i.isEmpty(null==c?void 0:c.text)||(S.states=c.text);const E=B(A.text,s),L=E.width,k=E.height;v+=L;const M=null!==(t=n.size)&&void 0!==t?t:10,w=i.isNumber(M)?M:Math.max(M[0],M[1]);m+=Math.max(k,(null==n?void 0:n.visible)?w:0);const{textAlign:T,textBaseline:C}=s;(i.isValid(l)||i.isValid(d))&&(i.isValid(l)&&v<l&&(v=l),i.isValid(d)&&v>d&&(v=d,S.setAttribute("maxLineWidth",d-b[1]-b[2])));let P=0,O=0;"center"===T?(P-=v/2,p&&p.setAttribute("x",(p.attribute.x||0)-L/2),g.setAttribute("x",-y/2)):"right"===T||"end"===T?(P-=v,p&&p.setAttribute("x",(p.attribute.x||0)-L),g.setAttribute("x",-b[1]-y)):"left"!==T&&"start"!==T||g.setAttribute("x",b[3]),"middle"===C?(O-=m/2,p&&p.setAttribute("y",0)):"bottom"===C?(O-=m,p&&p.setAttribute("y",-k/2),g.setAttribute("y",-b[2])):"top"===C&&(g.setAttribute("y",b[0]),p&&p.setAttribute("y",k/2));const{visible:I}=a,H=o(a,["visible"]);if(u&&i.isBoolean(I)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},H),{visible:I&&!!e,x:P,y:O,width:v,height:m}),"rect");i.isEmpty(null==c?void 0:c.panel)||(t.states=c.panel)}}}w.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const T=new i.AABBBounds;class C extends a{constructor(t){super(i.merge({},C.defaultAttributes,t)),this.name="poptip",this.positionList=["top","tl","tr","bottom","bl","br","left","lt","lb","right","rt","rb"]}render(){var t,e,s,n,a,r,l,d;const{titleStyle:h={},position:u,contentStyle:c={},panel:b={},space:g=4,minWidth:p=0,maxWidth:v=1/0,padding:m=4,maxWidthPercent:_,visible:y,state:x,dx:f=0,dy:A=0}=this.attribute;let{title:S="",content:E=""}=this.attribute;S=this.attribute.titleFormatMethod?this.attribute.titleFormatMethod(S):S,E=this.attribute.contentFormatMethod?this.attribute.contentFormatMethod(E):E;const L=i.normalizePadding(m),k=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group"),M=v-L[1]-L[3],B=i.isValid(S)&&!1!==y,w=Object.assign(Object.assign({text:i.isArray(S)?S:[S],visible:B},h),{x:L[3],y:L[0],maxLineWidth:M,textAlign:"left",textBaseline:"top"}),C=k.createOrUpdateChild("poptip-title",w,"wrapText");i.isEmpty(null==x?void 0:x.title)||(C.states=x.title);const P=C.AABBBounds,O=P.height(),I=P.width();let H=O+g;B||(H=0);const V=i.isValid(E)&&!1!==y,z=Object.assign(Object.assign({text:i.isArray(E)?E:[E],visible:V},c),{x:L[3],y:L[0]+H,maxLineWidth:M,textAlign:"left",textBaseline:"top"}),j=k.createOrUpdateChild("poptip-content",z,"wrapText");i.isEmpty(null==x?void 0:x.content)||(j.states=x.content);const R=j.AABBBounds,N=R.height(),D=R.width();V&&(H+=N);let $=i.max(I+L[1]+L[3],D+L[1]+L[3]);$>v?$=v:$<p&&($=p);let W=L[0]+L[2]+H;const{visible:U}=b,F=o(b,["visible"]),G=null!==(t=F.size)&&void 0!==t?t:12,Y=i.isArray(G)?[G[0]+(null!==(e=F.space)&&void 0!==e?e:0),G[1]+(null!==(s=F.space)&&void 0!==s?s:0)]:G+(null!==(n=F.space)&&void 0!==n?n:0),X=null!==(a=F.lineWidth)&&void 0!==a?a:1,q=this.stage?[null!==(r=this.stage.viewWidth)&&void 0!==r?r:this.stage.width,null!==(l=this.stage.viewHeight)&&void 0!==l?l:this.stage.height]:void 0;if(q){const t=this.AABBBounds,e=null!==(d=this.attribute.x)&&void 0!==d?d:t.x1,s=q[0]-t.x1;let n=Math.max(e,s);const a=(i.isArray(G)?G[0]:12)+3;if(n=Math.min(n-a,n*_),n<$){$=n;const t=L[1]+L[3];C.setAttribute("maxLineWidth",n-t),j.setAttribute("maxLineWidth",n-t),W=L[0]+L[2],B&&(W+=C.AABBBounds.height()+g),W+=j.AABBBounds.height()}}const Z="auto"===u;let J,K=-1/0;for(let t=0;t<this.positionList.length+1;t++){const e=Z?this.positionList[t===this.positionList.length?J:t]:u,{angle:s,offset:n,rectOffset:a}=this.getAngleAndOffset(e,$,W,i.isArray(Y)?Y:[Y,Y-X]);if(i.isBoolean(U)){const t=(i.isArray(G)?G[0]:G)/4,e=k.createOrUpdateChild("poptip-symbol-panel",Object.assign(Object.assign({},F),{visible:U&&(V||B),x:t,y:0,strokeBoundsBuffer:-1,boundsPadding:-2,anchor:[0,0],symbolType:"arrow2Left",angle:s,dx:n[0],dy:n[1],size:G,zIndex:-9}),"symbol");i.isEmpty(null==x?void 0:x.panel)||(e.states=x.panel);const a=k.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},F),{visible:U&&(V||B),x:0,y:0,width:$,height:W,zIndex:-8}),"rect");i.isEmpty(null==x?void 0:x.panel)||(a.states=x.panel)}if(k.setAttributes({x:-n[0]+f,y:-n[1]+A}),!Z||!q)break;{T.setValue(0,0,$,W).transformWithMatrix(k.globalTransMatrix);const e=T,s=(new i.Bounds).setValue(0,0,q[0],q[1]);if(i.rectInsideAnotherRect(e,s,!1))break;{const n=i.getRectIntersect(e,s,!1),a=(n.x2-n.x1)*(n.y2-n.y1);a>K&&(K=a,J=t)}}}}getAngleAndOffset(t,e,s,n){const a=n[1]/2;switch(t){case"tl":return{angle:i.pi/2*3,offset:[e/4,s+a],rectOffset:[-e/4,-s-n[1]]};case"top":return{angle:i.pi/2*3,offset:[e/2,s+a],rectOffset:[0,-s-n[1]]};case"tr":return{angle:i.pi/2*3,offset:[e/4*3,s+a],rectOffset:[e/4*3,-s-n[1]]};case"rt":return{angle:0,offset:[-a,s/5],rectOffset:[e/4*3,-s-n[1]]};case"right":return{angle:0,offset:[-a,s/2],rectOffset:[e/4*3,-s-n[1]]};case"rb":return{angle:0,offset:[-a,s/5*4],rectOffset:[e/4*3,-s-n[1]]};case"bl":return{angle:i.pi/2,offset:[e/4,-a],rectOffset:[-e/4,-s-n[1]]};case"bottom":return{angle:i.pi/2,offset:[e/2,-a],rectOffset:[0,-s-n[1]]};case"br":return{angle:i.pi/2,offset:[e/4*3,-a],rectOffset:[e/4*3,-s-n[1]]};case"lt":return{angle:i.pi,offset:[e+a,s/5],rectOffset:[-e/4,-s-n[1]]};case"left":return{angle:i.pi,offset:[e+a,s/2],rectOffset:[0,-s-n[1]]};case"lb":return{angle:i.pi,offset:[e+a,s/5*4],rectOffset:[e/4*3,-s-n[1]]}}}}C.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var P="inversify:paramtypes",O=0;var I=function(t){this.id=O++,this.registry=t};function H(){return function(t){if(Reflect.hasOwnMetadata(P,t))throw new Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(P,e,t),t}}const V={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},z={poptip:i.merge({},V)};let j=class{render(t,e,s,n,a,r,l,o,d,h,u,c,b){var g,p,v;if(1===t._showPoptip){const{visible:e,visibleCb:s}=t.attribute.poptip||{};if(!1===e||s&&!1===s(t))return;const n={};i.merge(n,C.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(n):this.poptipComponent=new C(n);let a=t.attribute.poptip||{};if("text"===t.type&&null==a.title&&null==a.content){const e={};p=e,v=a,i.merge(p,z.poptip,v),a=e,a.content=null!==(g=a.content)&&void 0!==g?g:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},a),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const l=h.stage.getLayer("_builtin_interactive");l&&l.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};j=d([H()],j);let R=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=e.Generator.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};R=d([H()],R);let N=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=e.Generator.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};N=d([H()],N);const D=new I(((t,i,s,n)=>{s(j)||(t(j).toSelf().inSingletonScope(),t(e.InteractiveSubRenderContribution).toService(j)),s(R)||(t(R).toSelf(),t(e.AutoEnablePlugins).toService(R)),s(N)||(t(N).toSelf(),t(e.AutoEnablePlugins).toService(N))}));class $ extends a{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class W extends ${constructor(t){super(i.merge({},W.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}W.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class U extends ${constructor(t){super(i.merge({},U.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}U.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class F extends ${constructor(t){super(i.merge({},F.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,s=i.PointService.distancePP(t,e);this.setAttribute("radius",s)}}F.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class G extends ${constructor(t){super(i.merge({},G.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:a,endAngle:r}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:a,endAngle:r}),n),"arc")}setLocation(t){const{center:e,startAngle:s=A,endAngle:n=S}=this.attribute,a=n-s,r=i.radianToDegree(i.getAngleByPoint(e,t));this.setAttributes({startAngle:r-a/2,endAngle:r+a/2})}}G.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class Y extends ${constructor(t){super(i.merge({},Y.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:s,sides:n=6,lineStyle:a}=this.attribute,{startAngle:r,endAngle:l}=this.attribute,o=(l-r)%(2*Math.PI)==0,d=(l-r)/n;let h;for(let t=0;t<=n;t++){const a=r+d*t,l=i.polarToCartesian(e,s,a);0===t?h=`M${l.x},${l.y}`:h+=`L${l.x},${l.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},a),"path")}setLocation(t){const{center:e}=this.attribute,s=i.PointService.distancePP(t,e);this.setAttribute("radius",s)}}Y.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const X=5,q=31,Z=32,J=new Uint32Array(Z+1),K=new Uint32Array(Z+1);K[0]=0,J[0]=~K[0];for(let t=1;t<=Z;++t)K[t]=K[t-1]<<1|1,J[t]=~K[t];function Q(t,e,i=0){const s=Math.max(1,Math.sqrt(t*e/1e6)),n=~~((t+2*i+s)/s),a=~~((e+2*i+s)/s),r=t=>~~((t+i)/s);return r.invert=t=>t*s-i,r.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+Z)/Z));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>X]&1<<(n&q)},set:(e,i)=>{const n=i*t+e;s(n>>>X,1<<(n&q))},clear:(e,i)=>{const s=i*t+e;n(s>>>X,~(1<<(s&q)))},getRange:({x1:s,y1:n,x2:a,y2:r})=>{if(a<0||r<0||s>t||n>e)return!0;let l,o,d,h,u=r;for(;u>=n;--u)if(l=u*t+s,o=u*t+a,d=l>>>X,h=o>>>X,d===h){if(i[d]&J[l&q]&K[1+(o&q)])return!0}else{if(i[d]&J[l&q])return!0;if(i[h]&K[1+(o&q)])return!0;for(let t=d+1;t<h;++t)if(i[t])return!0}return!1},setRange:({x1:i,y1:n,x2:a,y2:r})=>{if(a<0||r<0||i>t||n>e)return;let l,o,d,h,u;for(;n<=r;++n)if(l=n*t+i,o=n*t+a,d=l>>>X,h=o>>>X,d===h)s(d,J[l&q]&K[1+(o&q)]);else for(s(d,J[l&q]),s(h,K[1+(o&q)]),u=d+1;u<h;++u)s(u,4294967295)},clearRange:({x1:e,y1:i,x2:s,y2:a})=>{let r,l,o,d,h;for(;i<=a;++i)if(r=i*t+e,l=i*t+s,o=r>>>X,d=l>>>X,o===d)n(o,K[r&q]|J[1+(l&q)]);else for(n(o,K[r&q]),n(d,J[1+(l&q)]),h=o+1;h<d;++h)n(h,0)},outOfBounds:({x1:i,y1:s,x2:n,y2:a})=>i<0||s<0||a>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),a=n.data;for(let s=0;s<e;++s)for(let e=0;e<t;++e){const n=s*t+e,r=4*n,l=i[n>>>X]&1<<(n&q);a[r+0]=255*l,a[r+1]=255*l,a[r+2]=255*l,a[r+3]=31}return n}}}(n,a),r.ratio=s,r.padding=i,r.width=t,r.height=e,r}function tt(t,e,s=!1){if(s){const{x1:s,x2:n,y1:a,y2:r}=e,l=i.clamp(s,0,t.width),o=i.clamp(n,0,t.width),d=i.clamp(a,0,t.height),h=i.clamp(r,0,t.height);return{x1:t(l),x2:t(o),y1:t(d),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function et(t,e,i,s=!0,n=0){let a=i;n>0&&(a={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),a=tt(t,a);return!(s&&e.outOfBounds(a))&&!e.getRange(a)}function it(t,e,s,n=[],a=!0,r=0){const l=n.filter((t=>i.isValid(t)));for(let i=0;i<l.length;i++){const n=s.clone();if(n.setAttributes(l[i]),n.update(),et(t,e,tt(t,n.AABBBounds),a,r))return e.setRange(tt(t,n.AABBBounds,!0)),l[i]}return!1}function st(t,e,s,n,a,r,l){var o,d;const h=null===(o=n.overlap)||void 0===o?void 0:o.clampForce,u=null===(d=n.overlap)||void 0===d?void 0:d.overlapPadding;if("bound"===s.type||"position"===s.type){if(i.isFunction(l)){const o=((i.isFunction(s.position)?s.position(a.attribute):s.position)||function(t){if("rect"===t)return at;return nt}(n.type)).map((t=>l(a.AABBBounds,r,t,n.offset)));return it(t,e,a,o,h,u)}return!1}if("moveY"===s.type){const n=(s.offset?i.isFunction(s.offset)?s.offset(a.attribute):s.offset:[]).map((t=>({x:a.attribute.x,y:a.attribute.y+t})));return it(t,e,a,n,h,u)}if("moveX"===s.type){const n=(s.offset?i.isFunction(s.offset)?s.offset(a.attribute):s.offset:[]).map((t=>({x:a.attribute.x+t,y:a.attribute.y})));return it(t,e,a,n,h,u)}return!1}const nt=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],at=["top","inside-top","inside"];function rt(t,e,i){const{x1:s,x2:n,y1:a,y2:r}=t.AABBBounds,l=Math.min(s,n),o=Math.max(s,n),d=Math.min(a,r),h=Math.max(a,r);let u=0,c=0;return l<0&&o-l<=e?u=-l:o>e&&l-(o-e)>=0&&(u=e-o),d<0&&h-d<=i?c=-d:h>i&&d-(h-i)>=0&&(c=i-h),{dx:u,dy:c}}const lt={fadeIn:(t={})=>{var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:(t={})=>{var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function ot(t,e){var i,s;return null!==(s=null===(i=lt[e])||void 0===i?void 0:i.call(lt,t))&&void 0!==s?s:{from:{},to:{}}}const dt="same-time",ht=300,ut="linear";class ct extends a{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t){super(i.merge({},ct.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||i.isEmpty(e.states)||(e.addState(L.hover,!0),u(this,(t=>{t===e||i.isEmpty(t.states)||t.addState(L.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(u(this,(t=>{i.isEmpty(t.states)||(t.removeState(L.hoverReverse),t.removeState(L.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void u(this,(t=>{i.isEmpty(t.states)||(t.removeState(L.selectedReverse),t.removeState(L.selected))}));i.isEmpty(e.states)||(e.addState(L.selected,!0),u(this,(t=>{t===e||i.isEmpty(t.states)||t.addState(L.selectedReverse,!0)})),this._lastSelect=e)}}labeling(t,e,i,s){}_labelLine(t){}render(){if(this._prepare(),i.isNil(this._idToGraphic))return;const{overlap:t,smartInvert:e,dataFilter:s,customLayoutFunc:n,customOverlapFunc:a}=this.attribute;let r,l=this.attribute.data;i.isFunction(s)&&(l=s(l)),r=i.isFunction(n)?n(l,(t=>this._idToGraphic.get(t.id))):this._layout(l),i.isFunction(a)?r=a(r,(t=>this._idToGraphic.get(t.id))):!1!==t&&(r=this._overlapping(r)),!1!==e&&this._smartInvert(r),this._renderLabels(r)}_bindEvent(t){if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!i.isEmpty(e)&&(t.states=e)}_createLabelText(t){const i=e.createText(t);return this._bindEvent(i),this._setStates(i),i}_prepare(){var t;const e=[];let s;if(s=i.isFunction(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&e.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),this._baseMarks=e,!e||0===e.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){this._idToGraphic||(this._idToGraphic=new Map);for(let t=0;t<e.length;t++){const s=n[t],a=e[t];s&&a&&(i.isValid(s.id)||(s.id=`vrender-component-${this.name}-${t}`),this._idToGraphic.set(s.id,a))}}}_layout(t=[]){const{textStyle:e={},position:s,offset:n}=this.attribute,a=[];for(let r=0;r<t.length;r++){const l=t[r],o=this._idToGraphic.get(l.id),d=Object.assign(Object.assign({fill:o.attribute.fill},e),l),h=this._createLabelText(d),u=this.getGraphicBounds(h),c=this.getGraphicBounds(o,{x:l.x,y:l.y}),b=this.labeling(u,c,i.isFunction(s)?s(l):s,n);b&&(d.x=b.x,d.y=b.y,h.setAttributes(b)),a.push(h)}return a}_overlapping(t){var e,s,n,a;if(0===t.length)return[];const r=this.attribute.overlap,l=[],o=this.getBaseMarkGroup(),d=null!==(e=r.size)&&void 0!==e?e:{width:null!==(s=null==o?void 0:o.AABBBounds.width())&&void 0!==s?s:0,height:null!==(n=null==o?void 0:o.AABBBounds.height())&&void 0!==n?n:0};if(0===d.width||0===d.height)return t;const{avoidBaseMark:h,strategy:u=[],hideOnHit:c=!0,clampForce:b=!0,avoidMarks:g=[],overlapPadding:p}=r,v=this._bmpTool||Q(d.width,d.height),m=this._bitmap||v.bitmap(),_=u.some((t=>"bound"===t.type));h&&(null===(a=this._baseMarks)||void 0===a||a.forEach((t=>{t.AABBBounds&&m.setRange(tt(v,t.AABBBounds,!0))}))),g.length>0&&g.forEach((t=>{i.isString(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&m.setRange(tt(v,t.AABBBounds,!0))})):t.AABBBounds&&m.setRange(tt(v,t.AABBBounds,!0))}));for(let e=0;e<t.length;e++){if(!1===t[e].visible)continue;const s=t[e],n=this._idToGraphic.get(s.attribute.id);if(s.update(),!i.isRectIntersect(n.AABBBounds,{x1:0,x2:v.width,y1:0,y2:v.height},!0))continue;if(et(v,m,s.AABBBounds,b,p)){if(!_){m.setRange(tt(v,s.AABBBounds,!0)),l.push(s);continue}if(_&&(null==n?void 0:n.AABBBounds)&&this._canPlaceInside(s.AABBBounds,null==n?void 0:n.AABBBounds)){m.setRange(tt(v,s.AABBBounds,!0)),l.push(s);continue}}let a=!1;for(let i=0;i<u.length;i++)if(a=st(v,m,u[i],this.attribute,s,this.getGraphicBounds(n,t[e]),this.labeling),!1!==a){s.setAttributes({x:a.x,y:a.y}),l.push(s);break}if(!a&&b){const{dx:t=0,dy:e=0}=rt(s,v.width,v.height);if((0!==t||0!==e)&&et(v,m,{x1:s.AABBBounds.x1+t,x2:s.AABBBounds.x2+t,y1:s.AABBBounds.y1+e,y2:s.AABBBounds.y2+e},void 0,p)){s.setAttributes({x:s.attribute.x+t,y:s.attribute.y+e}),m.setRange(tt(v,s.AABBBounds,!0)),l.push(s);continue}}!a&&!c&&l.push(s)}return i.isFunction(this.onAfterLabelOverlap)&&this.onAfterLabelOverlap(m),l}getBaseMarkGroup(){const{baseMarkGroupName:t}=this.attribute;if(t)return this.getRootNode().find((e=>e.name===t),!0)}getGraphicBounds(t,e={}){return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var s,n,a,r,l;const o=null!==(s=this.attribute.animation)&&void 0!==s?s:{},d=null!==(n=o.mode)&&void 0!==n?n:dt,h=null!==(a=o.duration)&&void 0!==a?a:ht,u=null!==(r=o.easing)&&void 0!==r?r:ut,c=null!==(l=o.delay)&&void 0!==l?l:0,b=new Map,g=this._graphicToText||new Map,p=[];t.forEach(((t,s)=>{var n,a,r,l,v,m,_;const y=this._labelLine(t),x=this._idToGraphic.get(t.attribute.id),f=(null==g?void 0:g.get(x))?"update":"enter";if("enter"===f){if(p.push(t),b.set(x,y?{text:t,labelLine:y}:{text:t}),x){const{from:e,to:i}=ot(t.attribute,"fadeIn");this.add(t),y&&this.add(y),x.once("animate-bind",(()=>{t.setAttributes(e);const n=this._afterRelatedGraphicAttributeUpdate(t,p,s,x,{mode:d,duration:h,easing:u,to:i,delay:c});x.on("afterAttributeUpdate",n)}))}}else if("update"===f){const s=g.get(x);g.delete(x),b.set(x,s);const d=s.text;d.animate().to(t.attribute,h,u),s.labelLine&&s.labelLine.animate().to(i.merge({},s.labelLine.attribute,{visible:null===(m=null!==(l=(null===(a=null===(n=t.attribute)||void 0===n?void 0:n.line)||void 0===a?void 0:a.visible)&&(null===(r=t.attribute)||void 0===r?void 0:r.visible))&&void 0!==l?l:null===(v=t.attribute)||void 0===v?void 0:v.visible)||void 0===m||m,points:null===(_=t.attribute)||void 0===_?void 0:_.points}),h,u),!1!==o.increaseEffect&&d.attribute.text!==t.attribute.text&&i.isValidNumber(Number(d.attribute.text)*Number(t.attribute.text))&&d.animate().play(new e.IncreaseCount({text:d.attribute.text},{text:t.attribute.text},h,u))}})),g.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(ot(t.text.attribute,"fadeOut").to,h,u).onEnd((()=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)}))})),this._graphicToText=b}_renderWithOutAnimation(t){const e=new Map,i=this._graphicToText||new Map;t.forEach((t=>{var s;const n=this._labelLine(t),a=this._idToGraphic.get(t.attribute.id),r=(null==i?void 0:i.get(a))?"update":"enter";if("enter"===r)e.set(a,n?{text:t,labelLine:n}:{text:t}),this.add(t),n&&this.add(n);else if("update"===r){const n=i.get(a);i.delete(a),e.set(a,n),n.text.setAttributes(t.attribute),(null==n?void 0:n.labelLine)&&n.labelLine.setAttributes({points:null===(s=t.attribute)||void 0===s?void 0:s.points})}})),i.forEach((t=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)})),this._graphicToText=e}_afterRelatedGraphicAttributeUpdate(t,i,s,n,{mode:a,duration:r,easing:l,to:o,delay:d}){const h=u=>{var c;const{detail:b}=u;if(!b)return{};if(!(b&&b.type===e.AttributeUpdateType.ANIMATE_UPDATE&&b.animationState&&"wait"!==(null===(c=b.animationState.step)||void 0===c?void 0:c.type)))return{};if(b.type===e.AttributeUpdateType.ANIMATE_END)return void t.setAttributes(o);const g=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",h))};switch(a){case"after":b.animationState.end&&t.animate({onEnd:g}).wait(d).to(o,r,l);break;case"after-all":s===i.length-1&&b.animationState.end&&i.forEach((t=>{t.animate({onEnd:g}).wait(d).to(o,r,l)}));break;default:b.animationState.isFirstFrameOfStep&&t.animate({onEnd:g}).wait(d).to(o,r,l)}};return h}_smartInvert(t){var e,i,s,n;const a=this.attribute.smartInvert||{},{textType:r,contrastRatiosThreshold:l,alternativeColors:o}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",h=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",u=null!==(s=a.brightColor)&&void 0!==s?s:"#ffffff",c=null!==(n=a.darkColor)&&void 0!==n?n:"#000000";if("null"!==d||"null"!==h)for(let e=0;e<t.length;e++){const i=t[e];if(!i)continue;const s=this._idToGraphic.get(i.attribute.id),n=this._canPlaceInside(i.AABBBounds,null==s?void 0:s.AABBBounds),a=s.attribute.fill,b=a,v=g(i.attribute.fill,a,r,l,o),m=p(v,u)?u:c;if(n){const t=y(d,b,v,m);if(t&&i.setAttributes({fill:t}),0===i.attribute.lineWidth)continue;const e=y(h,b,v,m);e&&i.setAttributes({stroke:e})}else{if(0===i.attribute.lineWidth)continue;if(i.attribute.stroke){i.setAttributes({fill:g(i.attribute.fill,i.attribute.stroke,r,l,o)});continue}const t=y(d,b,v,m);t&&i.setAttributes({fill:t});const e=y(h,b,v,m);e&&i.setAttributes({stroke:e})}}}_canPlaceInside(t,e){return!(!t||!e)&&e.encloses(t)}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}ct.defaultAttributes={textStyle:{fontSize:12,textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},offset:0,pickable:!1};class bt extends ct{constructor(t){super(i.merge({},bt.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e,i="top",s=0){if(!t)return;const{x1:n,y1:a,x2:r,y2:l}=t,o=Math.abs(r-n),d=Math.abs(l-a),h=(e.x1+e.x2)/2,u=(e.y1+e.y2)/2;let c=0,b=0,g=0,p=0;e&&(g=Math.abs(e.x1-e.x2)/2,p=Math.abs(e.y1-e.y2)/2);const v={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":b=-1;break;case"bottom":b=1;break;case"left":c=-1;break;case"right":c=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":c=Math.sin(v[i]*(Math.PI/180)),b=Math.cos(v[i]*(Math.PI/180));break;case"center":c=0,b=0}return{x:h+c*(s+g)+Math.sign(c)*(o/2),y:u+b*(s+p)+Math.sign(b)*(d/2)}}}bt.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class gt extends ct{constructor(t){super(i.merge({},gt.defaultAttributes,t))}labeling(t,e,i="top",s=0){if(!t||!e)return;const{x1:n,y1:a,x2:r,y2:l}=t,o=Math.abs(r-n),d=Math.abs(l-a),h=Math.abs(e.x2-e.x1),u=Math.abs(e.y2-e.y1);let c=(e.x1+e.x2)/2,b=(e.y1+e.y2)/2,g=0,p=0;switch(i){case"top":case"inside-top":p=-.5;break;case"bottom":case"inside-bottom":p=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}c+=g*h,b+=p*u;let v=0,m=0;const _=i.includes("inside");i.includes("top")?m=_?1:-1:i.includes("bottom")?m=_?-1:1:i.includes("left")?v=_?1:-1:i.includes("right")&&(v=_?-1:1);return{x:c+v*s+v*o/2,y:b+m*s+m*d/2}}}gt.tag="rect-label",gt.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class pt extends ct{constructor(t){super(i.merge({},pt.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t,e={}){var i;if("line"!==t.type)return super.getGraphicBounds(t,e);const{position:s="end"}=this.attribute,n=(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)||[e],a="start"===s?0:n.length-1;return{x1:n[a].x,x2:n[a].x,y1:n[a].y,y2:n[a].y}}labeling(t,e,i="end",s=0){if(!t||!e)return;const{x1:n,x2:a}=t,r=Math.abs(a-n),l=e.x1;let o=l;return"end"===i?o=l+r/2+s:"start"===i&&(o=l-r/2-s),{x:o,y:e.y1}}}function vt(t,e,i,s){const n=(a={radius:i,angle:s}).radius?{x:Math.cos(a.angle)*a.radius,y:Math.sin(a.angle)*a.radius}:{x:0,y:0};var a;return{x:t+n.x,y:e+n.y}}function mt(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function _t(t){return 3===t||4===t}function yt(t,e){const{x1:i,y1:s,x2:n,y2:a}=t,{x1:r,y1:l,x2:o,y2:d}=e;return!(i<=r&&n<=r||i>=o&&n>=o||s<=l&&a<=l||s>=d&&a>=d)}pt.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"end",offset:6,pickable:!1};class xt{constructor(t,e,i,s,n,a,r,l,o){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=n,this.middleAngle=a,this.innerRadius=r,this.outerRadius=l,this.circleCenter=o,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class ft extends ct{constructor(t){super(i.merge({},ft.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e,i="outside",s=0){if(t&&e)return{x:0,y:0}}_layout(t=[]){const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),s=Object.assign(Object.assign({},this.attribute.textStyle),{text:"..."}),n=this._createLabelText(s),a=this.getGraphicBounds(n),r=a.x2-a.x1,l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),t,i,r);for(let i=0;i<t.length;i++){const s=t[i],n=l.find((t=>{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===s.id})),a={visible:n.labelVisible,x:n.labelPosition.x,y:n.labelPosition.y,angle:n.angle,maxLineWidth:n.labelLimit,points:(null==n?void 0:n.pointA)&&(null==n?void 0:n.pointB)&&(null==n?void 0:n.pointC)?[n.pointA,n.pointB,n.pointC]:void 0,line:null==n?void 0:n.labelLine};e[i].setAttributes(a)}return e}layoutArcLabels(t,e,s,n,a,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let l=0;s.forEach((t=>{t.attribute.outerRadius>l&&(l=t.attribute.outerRadius)})),s.forEach(((t,s)=>{var r,o;const d=t.attribute,h={x:null!==(r=null==d?void 0:d.x)&&void 0!==r?r:0,y:null!==(o=null==d?void 0:d.y)&&void 0!==o?o:0};if(!i.isNil(n[s])&&!i.isNil(a[s])){const t=n[s]?n[s]:null,i=a[s]?a[s]:{x1:0,x2:0,y1:0,y2:0},r=(d.startAngle+d.endAngle)/2,o=d.endAngle-d.startAngle,c=mt(d.endAngle-o/2),b=vt(h.x,h.y,d.outerRadius,r),g=vt(h.x,h.y,l+e.line.line1MinLength,r),p=new xt(t,b,g,c,o,r,d.innerRadius,d.outerRadius,h);p.pointA=vt(h.x,h.y,this.computeDatumRadius(2*h.x,2*h.y,d.outerRadius),p.middleAngle),p.labelSize={width:i.x2-i.x1,height:i.y2-i.y1},1===(u=p.quadrant)||2===u?this._arcRight.set(p.refDatum,p):_t(p.quadrant)&&this._arcLeft.set(p.refDatum,p)}var u}));const o=Array.from(this._arcLeft.values()),d=Array.from(this._arcRight.values()),h=[];return"inside"===t?(h.push(...this._layoutInsideLabels(d,e,s)),h.push(...this._layoutInsideLabels(o,e,s))):(h.push(...this._layoutOutsideLabels(d,e,s)),h.push(...this._layoutOutsideLabels(o,e,s))),h}_layoutInsideLabels(t,e,s){const n=e,a=n.spaceWidth;return t.forEach((t=>{var s,r;const{labelSize:l,radian:o}=t,d=t.innerRadius,h=t.outerRadius,u=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,l.height);let c;if(o<u)c=0;else{let t;t=o>=Math.PI?d:Math.max(d,l.height/2/Math.tan(o/2)),c=h-t-a}!0!==(null==n?void 0:n.rotate)&&(c=h-a);const b=this._getFormatLabelText(t.refDatum,c);t.labelText=b;const g=Math.min(c,t.labelSize.width),p=this._computeAlign(t,e),v=h-a-("left"===p?g:"right"===p?0:g/2);t.labelPosition=vt(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=g,i.isGreater(g,0)||(t.labelVisible=!1),t.angle=null!==(r=null===(s=null==e?void 0:e.textStyle)||void 0===s?void 0:s.angle)&&void 0!==r?r:t.middleAngle})),t}_layoutOutsideLabels(t,e,s){var n,a,r,l,o;const d=null!==(a=null===(n=s[0].attribute)||void 0===n?void 0:n.x)&&void 0!==a?a:0,h=2*(null!==(l=null===(r=s[0].attribute)||void 0===r?void 0:r.y)&&void 0!==l?l:0),u=e.line.line2MinLength,c=e.layout,b=e.spaceWidth;if(t.forEach((t=>{const e=_t(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+u+b),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===c.strategy){for(const i of t){const{labelPosition:t,labelSize:n}=i;i.labelLimit=n.width,i.pointB=_t(i.quadrant)?{x:t.x+n.width/2+u+b,y:t.y}:{x:t.x-n.width/2-u-b,y:t.y},this._computeX(i,e,s)}!1===e.coverEnable&&"none"===c.strategy&&this._coverLabels(t)}else{const i=h/((null===(o=e.textStyle)||void 0===o?void 0:o.fontSize)||16);this._adjustY(t,i,e,s);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(h,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),r=Math.max(Math.abs(h/2-n),Math.abs(a-h/2)),l=this._computeLayoutRadius(r,e,s);for(const i of t)this._computePointB(i,l,e,s),this._computeX(i,e,s)}const g=2*d;return t.forEach((t=>{var s,n;t.labelVisible&&(i.isLess(t.pointB.x,u+b)||i.isGreater(t.pointB.x,g-u-b))&&(t.labelVisible=!1),t.angle=null!==(n=null===(s=null==e?void 0:e.textStyle)||void 0===s?void 0:s.angle)&&void 0!==n?n:0,t.labelLine=Object.assign({},null==e?void 0:e.line)})),t}_computeX(t,e,s){var n;const a=t.circleCenter,r=2*a.x;a.y;let l=0;s.forEach((t=>{t.attribute.outerRadius>l&&(l=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(l,e.width,e.height),d=e.line.line1MinLength,h=e.line.line2MinLength,u=null===(n=e.layout)||void 0===n?void 0:n.align,c=e.spaceWidth,{labelPosition:b,quadrant:g,pointB:p}=t;i.isValidNumber(p.x*p.y)||(t.pointC={x:NaN,y:NaN},b.x=NaN,t.labelLimit=0);const v=this.computeRadius(o,e.width,e.height),m=_t(g)?-1:1;let _=0;let y=(m>0?r-p.x:p.x)-h-c;"labelLine"===u&&(_=(v+d+h)*m+a.x,y=(m>0?r-_:_)-c);const x=this._getFormatLabelText(t.refDatum,y);t.labelText=x;let f=Math.min(y,t.labelSize.width);switch(u){case"labelLine":break;case"edge":_=m>0?r-f-c:f+c;break;default:_=p.x+m*h}f=Math.max(this._ellipsisWidth,f),t.labelLimit=f,t.pointC={x:_,y:b.y};const A=.5*(t.labelLimit<t.labelSize.width?t.labelLimit:t.labelSize.width);if("edge"===u){const t=0;b.x=(m>0?r+t:t)-m*A}else{const t=0;b.x=_+t+m*(c+A)}}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_computeAlign(t,e){var s,n,a,r,l,o;const d=e,h=null!==(n=null===(s=d.textStyle)||void 0===s?void 0:s.textAlign)&&void 0!==n?n:null===(a=d.textStyle)||void 0===a?void 0:a.align,u=null!==(l=null===(r=d.layout)||void 0===r?void 0:r.textAlign)&&void 0!==l?l:null===(o=d.layout)||void 0===o?void 0:o.align;return"inside"!==d.position?i.isNil(h)||"auto"===h?"edge"===u?_t(t.quadrant)?"left":"right":_t(t.quadrant)?"right":"left":h:i.isNil(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,s,n){var a,r,l,o;r=null===(a=n[0].attribute)||void 0===a?void 0:a.x;const d=2*(null!==(o=null===(l=n[0].attribute)||void 0===l?void 0:l.y)&&void 0!==o?o:0),h=s.layout;if("vertical"===h.strategy){let e,s=0;const n=t.length;if(n<=0)return;for(let a=0;a<n;a++){const{y1:r}=t[a].getLabelBounds();if(e=r-s,i.isLess(e,0)){const i=this._shiftY(t,a,n-1,-e);this._shiftY(t,i,0,e/2)}const{y2:l}=t[a].getLabelBounds();s=l}const{y1:a}=t[0].getLabelBounds();e=a-0,i.isLess(e,0)&&this._shiftY(t,0,n-1,-e);for(let e=t.length-1;e>=0&&t[e].getLabelBounds().y2>d;e--)t[e].labelVisible=!1}else if("none"!==h.strategy){const a=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));a.sort(((t,e)=>e.arc.radian-t.arc.radian)),a.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,l=-1/0;for(let o=0;o<e&&o<t.length;o++){this._storeY(t);const e=a[o].arc;this._computeYRange(e,s,n),e.labelVisible=!0;const u=e.labelPosition.y,{lastIndex:c,nextIndex:b}=this._findNeighborIndex(t,a[o]),g=t[c],p=t[b];if(-1===c&&-1!==b){const i=p.labelPosition.y;u>i?e.labelPosition.y=i-p.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,p,b)}else if(-1!==c&&-1===b){const i=g.labelPosition.y;u<i?e.labelPosition.y=i+g.labelSize.height/2+e.labelSize.height/2:this._twoWayShift(t,g,e,a[o].originIndex)}else if(-1!==c&&-1!==b){const i=g.labelPosition.y,s=p.labelPosition.y;u>s?(e.labelPosition.y=s-p.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,g,e,a[o].originIndex)):u<i?(e.labelPosition.y=i+g.labelSize.height/2+e.labelSize.height/2,this._twoWayShift(t,e,p,b)):(this._twoWayShift(t,g,e,a[o].originIndex),this._twoWayShift(t,e,p,b))}const v=Math.min(r,a[o].originIndex),m=Math.max(l,a[o].originIndex);let _;if(_=t[m].getLabelBounds().y2-d,i.isGreater(_,0)&&this._shiftY(t,m,0,-_),_=t[v].getLabelBounds().y1-0,i.isLess(_,0)&&this._shiftY(t,v,t.length-1,-_),_=t[m].getLabelBounds().y2-d,i.isGreater(_,0)){e.labelVisible=!1,this._restoreY(t);break}h.tangentConstraint&&!this._checkYRange(t)?(e.labelVisible=!1,this._restoreY(t)):(r=v,l=m)}}}_shiftY(t,e,i,s){const n=e<i?1:-1;let a=e;for(;-1!==a;){t[a].labelPosition.y+=s;const e=this._findNextVisibleIndex(t,a,i,n);if(e>=0&&e<t.length){const{y1:i,y2:s}=t[a].getLabelBounds(),{y1:r,y2:l}=t[e].getLabelBounds();if(n>0&&s<r||n<0&&i>l)return a}a=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,s,n){const a=s;let r=0;n.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const l=this.computeLayoutOuterRadius(r,s.width,s.height),o=a.line.line1MinLength;if("none"===a.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const n=t.circleCenter,a=this.computeRadius(l,s.width,s.height),{labelPosition:r,quadrant:d}=t,h=e-Math.max(a+o,t.outerRadius),u=Math.sqrt(e**2-Math.abs(n.y-r.y)**2)-h;i.isValidNumber(u)?t.pointB={x:n.x+u*(_t(d)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,s){const n=t.circleCenter,a={width:2*n.x,height:2*n.y};let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const l=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:d,height:h}=a,u=this.computeRadius(l,e.width,e.height),c=this._computeLayoutRadius(h/2,e,s),b=Math.abs(t.center.x-d/2),g=t.center.y-h/2;let p,v,m;if(i.isNumberClose(d/2,b))p=0,v=1,m=-g;else if(i.isNumberClose(h/2,g))p=1,v=0,m=-b;else{const t=-1/(g/b);p=t,v=-1,m=g-t*b}const _=function(t,e,i,s,n,a){if(0===t&&0===e||a<=0)return[];if(0===t){const t=-i/e,r=a**2-(t-n)**2;return r<0?[]:0===r?[{x:s,y:t}]:[{x:Math.sqrt(r)+s,y:t},{x:-Math.sqrt(r)+s,y:t}]}if(0===e){const e=-i/t,r=a**2-(e-s)**2;return r<0?[]:0===r?[{x:e,y:n}]:[{x:e,y:Math.sqrt(r)+n},{x:e,y:-Math.sqrt(r)+n}]}const r=(e/t)**2+1,l=2*((i/t+s)*(e/t)-n),o=l**2-4*r*((i/t+s)**2+n**2-a**2);if(o<0)return[];const d=(-l+Math.sqrt(o))/(2*r),h=(-l-Math.sqrt(o))/(2*r),u=-(e*d+i)/t;return 0===o?[{x:u,y:d}]:[{x:u,y:d},{x:-(e*h+i)/t,y:h}]}(p,v,m,o+u-c,0,c);if(_.length<2)return;let y,x;_[0].x>_[1].x&&_.reverse(),_[0].x<0?i.isNumberClose(_[0].y,_[1].y)?Math.abs(t.middleAngle)<Math.PI/2?(y=0,x=_[1].y+h/2):(y=_[1].y+h/2,x=h):_[0].y<_[1].y?(y=0,x=_[1].y+h/2):(y=_[1].y+h/2,x=a.height):(y=Math.min(_[0].y,_[1].y)+h/2,x=Math.max(_[0].y,_[1].y)+h/2),t.labelYRange=[y,x]}_computeLayoutRadius(t,e,i){const s=e,n=s.layoutArcGap,a=s.line.line1MinLength;let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const l=this.computeLayoutOuterRadius(r,e.width,e.height),o=this.computeRadius(l,e.width,e.height)+a,d=o-n;return Math.max((d**2+t**2)/(2*d),o)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e<t.length;e++)if(t[e].labelVisible){n=e;break}return{lastIndex:s,nextIndex:n}}_twoWayShift(t,e,s,n){const a=s.getLabelBounds().y1-e.getLabelBounds().y2;if(i.isLess(a,0)){const e=this._shiftY(t,n,t.length-1,-a);this._shiftY(t,e,0,a/2)}}_restoreY(t){for(const e of t)e.labelVisible&&(e.labelPosition.y=e.lastLabelY)}_checkYRange(t){for(const e of t){const{labelYRange:t,labelPosition:s}=e;if(e.labelVisible&&t&&(i.isLess(s.y,t[0])||i.isGreater(s.y,t[1])))return!1}return!0}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i<t.length;i++){const s=t[i].getLabelBounds();yt(e,s)?t[i].labelVisible=!1:e=s}}_labelLine(t){var i,s,n,a,r,l,o,d,h,u,c,b,g,p,v,m,_,y,x;return(null===(i=t.attribute)||void 0===i?void 0:i.points)?e.createLine({visible:null===(o=null!==(r=(null===(n=null===(s=t.attribute)||void 0===s?void 0:s.line)||void 0===n?void 0:n.visible)&&(null===(a=t.attribute)||void 0===a?void 0:a.visible))&&void 0!==r?r:null===(l=t.attribute)||void 0===l?void 0:l.visible)||void 0===o||o,stroke:null!==(c=null===(u=null===(h=null===(d=t.attribute)||void 0===d?void 0:d.line)||void 0===h?void 0:h.style)||void 0===u?void 0:u.stroke)&&void 0!==c?c:null===(b=t.attribute)||void 0===b?void 0:b.fill,lineWidth:null!==(m=null===(v=null===(p=null===(g=t.attribute)||void 0===g?void 0:g.line)||void 0===p?void 0:p.style)||void 0===v?void 0:v.lineWidth)&&void 0!==m?m:1,points:null===(_=t.attribute)||void 0===_?void 0:_.points,curveType:(null===(x=null===(y=t.attribute)||void 0===y?void 0:y.line)||void 0===x?void 0:x.smooth)?"basis":null}):void 0}computeRadius(t,e,s,n){return this.computeLayoutRadius(e||0,s||0)*t*(i.isNil(n)?1:n)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return"inside"===this.attribute.position}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){const s=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*s}}ft.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,textAlign:"center",textBaseline:"middle"},position:"outside",offset:0,line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0},pickable:!1};const At={rect:gt,symbol:bt,arc:ft};class St extends a{constructor(t){super(i.merge({},St.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:s=0,height:n=0}=e||{};if(!s||!n||!i.isValidNumber(n*s))return;this._componentMap||(this._componentMap=new Map);const a=Q(s,n),r=a.bitmap(),l=new Map,o=this._componentMap;for(let e=0;e<t.length;e++){const i=t[e],s=At[i.type]||ct;if(s){const{baseMarkGroupName:t}=i;let e=this._componentMap.get(t);e?(e.setBitmapTool(a),e.setBitmap(r),e.setAttributes(i),l.set(t,e)):(e=new s(i),e.setBitmap(r),e.setBitmapTool(a),this.add(e),l.set(t,e))}}o.forEach(((t,e)=>{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}St.defaultAttributes={pickable:!1};class Et extends a{getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t){super(i.merge({},Et.defaultAttributes,t)),this.name="segment"}render(){this.removeAllChild(),this._reset();const{startSymbol:t,endSymbol:s,lineStyle:n,state:a,visible:r=!0,multiSegment:l,mainSegmentIndex:o}=this.attribute;if(!r)return;this._computeLineAngle();const d=this._renderSymbol(t,"start"),h=this._renderSymbol(s,"end");if(this.startSymbol=d,this.endSymbol=h,l){const t=[...this.attribute.points];if(i.isValidNumber(o))t[o]=this._clipPoints(t[o]);else{const e=this._clipPoints(i.flattenArray(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,s)=>{var r,l;const o=e.createLine(Object.assign(Object.assign({points:t},i.isArray(n)?null!==(r=n[s])&&void 0!==r?r:n[n.length-1]:n),{fill:!1}));o.name=`${this.name}-line`,o.id=this._getNodeId("line"+s),i.isEmpty(null==a?void 0:a.line)||(o.states=i.isArray(a.line)?null!==(l=a.line[s])&&void 0!==l?l:a.line[a.line.length-1]:a.line),this.add(o)}))}else{const t=e.createLine(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},i.array(n)[0]),{fill:!1}));t.name=`${this.name}-line`,t.id=this._getNodeId("line"),i.isEmpty(null==a?void 0:a.line)||(t.states=[].concat(a.line)[0]),this.add(t)}}_renderSymbol(t,s){const n=this._getMainSegmentPoints();if(!n.length)return;const{autoRotate:a=!0}=t;let r;if(null==t?void 0:t.visible){const l=this._startAngle,o=this._endAngle,{state:d}=this.attribute,h=n[0],u=n[n.length-1],{refX:c=0,refY:b=0,refAngle:g=0,style:p,symbolType:v,size:m=12}=t;let _,y;"start"===s?(_={x:h.x+(i.isValidNumber(l)?c*Math.cos(l)+b*Math.cos(l-Math.PI/2):0),y:h.y+(i.isValidNumber(l)?c*Math.sin(l)+b*Math.sin(l-Math.PI/2):0)},y=l+Math.PI/2):(_={x:u.x+(i.isValidNumber(o)?c*Math.cos(o)+b*Math.cos(o-Math.PI/2):0),y:u.y+(i.isValidNumber(o)?c*Math.sin(o)+b*Math.sin(o-Math.PI/2):0)},y=o+Math.PI/2),r=e.createSymbol(Object.assign(Object.assign(Object.assign({},_),{symbolType:v,size:m,angle:a?y+g:0,strokeBoundsBuffer:0}),p)),r.name=`${this.name}-${s}-symbol`,r.id=this._getNodeId(`${s}-symbol`),i.isEmpty(null==d?void 0:d.symbol)||(r.states=d.symbol),this.add(r)}return r}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:s}=this.attribute;let n;return n=e?i.isValidNumber(s)?t[s]:i.flattenArray(t):t,this._mainSegmentPoints=n,n}_clipPoints(t){const{startSymbol:e,endSymbol:i}=this.attribute;let s=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0:i.size)||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],a=[e.x-i.x,e.y-i.y],r=Math.atan2(a[1],a[0]),l=[n.x-s.x,n.y-s.y],o=Math.atan2(l[1],l[0]);this._startAngle=r,this._endAngle=o}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}var Lt,kt;Et.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},t.AXIS_ELEMENT_NAME=void 0,(Lt=t.AXIS_ELEMENT_NAME||(t.AXIS_ELEMENT_NAME={})).innerView="inner-view",Lt.axisContainer="axis-container",Lt.labelContainer="axis-label-container",Lt.tickContainer="axis-tick-container",Lt.tick="axis-tick",Lt.subTick="axis-sub-tick",Lt.label="axis-label",Lt.title="axis-title",Lt.gridContainer="axis-grid-container",Lt.grid="axis-grid",Lt.gridRegion="axis-grid-region",Lt.line="axis-line",Lt.background="axis-background",Lt.axisLabelBackground="axis-label-background",t.AxisStateValue=void 0,(kt=t.AxisStateValue||(t.AxisStateValue={})).selected="selected",kt.selectedReverse="selected_reverse",kt.hover="hover",kt.hoverReverse="hover_reverse";const Mt={[t.AxisStateValue.selectedReverse]:{},[t.AxisStateValue.selected]:{},[t.AxisStateValue.hover]:{},[t.AxisStateValue.hoverReverse]:{}},Bt={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}};class wt extends a{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{const e=t.target;e!==this._lastHover&&e.name&&!i.isEmpty(e.states)&&(e.addState(L.hover,!0),u(this.axisContainer,(t=>{t!==e&&t.name&&!i.isEmpty(t.states)&&t.addState(L.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(u(this.axisContainer,(t=>{t.name&&!i.isEmpty(t.states)&&(t.removeState(L.hoverReverse),t.removeState(L.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(L.selected))return this._lastSelect=null,void u(this.axisContainer,(t=>{t.name&&!i.isEmpty(t.states)&&(t.removeState(L.selectedReverse),t.removeState(L.selected))}));e.name&&!i.isEmpty(e.states)&&(e.addState(L.selected,!0),u(this.axisContainer,(t=>{t!==e&&t.name&&!i.isEmpty(t.states)&&t.addState(L.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const s=i.cloneDeep(this.attribute);i.merge(this.attribute,t);const n=e.createGroup({x:this.attribute.x,y:this.attribute.y});return this.add(n),this._renderInner(n),this.removeChild(n),this.attribute=s,n.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=e.createGroup({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(i){const{title:s,label:n,tick:a,line:r,items:l}=this.attribute,o=e.createGroup({x:0,y:0,zIndex:1});if(o.name=t.AXIS_ELEMENT_NAME.axisContainer,o.id=this._getNodeId("container"),o.setMode(this.mode),this.axisContainer=o,i.add(o),(null==r?void 0:r.visible)&&this.renderLine(o),l&&l.length&&(this.data=this._transformItems(l[0]),(null==a?void 0:a.visible)&&this.renderTicks(o),null==n?void 0:n.visible)){const i=e.createGroup({x:0,y:0,pickable:!1});i.name=t.AXIS_ELEMENT_NAME.labelContainer,i.id=this._getNodeId("label-container"),this.axisLabelsContainer=i,o.add(i),l.forEach(((t,e)=>{const s=this.renderLabels(i,t,e),n=s.getChildren();this.beforeLabelsOverlap(n,t,s,e,l.length),this.handleLabelsOverlap(n,t,s,e,l.length),this.afterLabelsOverlap(n,t,s,e,l.length)}))}(null==s?void 0:s.visible)&&this.renderTitle(o)}renderTicks(s){const n=this.getTickLineItems(),a=e.createGroup({x:0,y:0,pickable:!1});a.name=t.AXIS_ELEMENT_NAME.tickContainer,a.id=this._getNodeId("tick-container"),s.add(a),n.forEach(((s,r)=>{var l;const o=e.createLine(Object.assign({},this._getTickLineAttribute("tick",s,r,n)));if(o.name=t.AXIS_ELEMENT_NAME.tick,o.id=this._getNodeId(s.id),i.isEmpty(null===(l=this.attribute.tick)||void 0===l?void 0:l.state))o.states=k;else{const t=this.data[r],e=i.merge({},k,this.attribute.tick.state);Object.keys(e).forEach((s=>{i.isFunction(e[s])&&(e[s]=e[s](t.rawValue,r,t,this.data))})),o.states=e}a.add(o)})),this.tickLineItems=n;const{subTick:r}=this.attribute;if(null==r?void 0:r.visible){const s=this.getSubTickLineItems();s.length&&s.forEach(((s,l)=>{const o=e.createLine(Object.assign({},this._getTickLineAttribute("subTick",s,l,n)));if(o.name=t.AXIS_ELEMENT_NAME.subTick,o.id=this._getNodeId(`${l}`),i.isEmpty(r.state))o.states=k;else{const t=i.merge({},k,r.state);Object.keys(t).forEach((e=>{i.isFunction(t[e])&&(t[e]=t[e](s.value,l,s,n))})),o.states=t}a.add(o)})),this.subTickLineItems=s}}renderLabels(s,n,a){const{dataFilter:r}=this.attribute.label;r&&i.isFunction(r)&&(n=r(n,a));const l=this._transformItems(n),o=e.createGroup({x:0,y:0,pickable:!1});o.name=`${t.AXIS_ELEMENT_NAME.labelContainer}-layer-${a}`,o.id=this._getNodeId(`label-container-layer-${a}`),s.add(o);let d=0,h=0,u="center",c="middle";return l.forEach(((s,n)=>{var r,b;const g=this._getLabelAttribute(s,n,l,a),p=e.createText(g);if(p.name=t.AXIS_ELEMENT_NAME.label,p.id=this._getNodeId(`layer${a}-label-${s.id}`),i.isEmpty(null===(r=this.attribute.label)||void 0===r?void 0:r.state))p.states=k;else{const t=i.merge({},k,this.attribute.label.state);Object.keys(t).forEach((e=>{i.isFunction(t[e])&&(t[e]=t[e](s,n,l,a))})),p.states=t}o.add(p);const v=null!==(b=g.angle)&&void 0!==b?b:0;d=Math.max(d,p.AABBBounds.width()),h=Math.max(h,p.AABBBounds.height()),v&&(d=Math.abs(d*Math.cos(v)),h=Math.abs(h*Math.sin(v))),u=g.textAlign,c=g.textBaseline})),this.axisLabelLayerSize[a]={width:d,height:h,textAlign:u,textBaseline:c},o}renderTitle(e){const i=this.getTitleAttribute(),s=new w(Object.assign({},i));s.name=t.AXIS_ELEMENT_NAME.title,s.id=this._getNodeId("title"),e.add(s)}getVerticalCoord(t,e,i){const s=this.getVerticalVector(e,i,t);return{x:t.x+s[0],y:t.y+s[1]}}getTextAlign(t){let e="center";return i.isNumberClose(t[0],0)?i.isNumberClose(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,s=[],{alignWithLabel:n,inside:a=!1,length:r,dataFilter:l}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(l&&i.isFunction(l)?l(e):e).forEach((t=>{let e=t.point,l=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),l=i}const d=this.getVerticalCoord(e,r,a);if("3d"===this.mode){const n=this.getVerticalVector(r,a,e);let o=0,h=0;i.abs(n[0])>i.abs(n[1])?o=i.pi/2*(d.x>e.x?1:-1):h=i.pi/2*(d.y>e.y?-1:1),s.push({start:e,end:d,value:l,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else s.push({start:e,end:d,value:l,id:`tick-${t.id}`})})),s}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,a=this.tickLineItems,r=a.length;if(r>=2)for(let t=0;t<r-1;t++){const r=a[t],l=a[t+1];for(let t=0;t<i;t++){const a=(t+1)/(i+1),o=(1-a)*r.value+a*l.value,d=this.getTickCoord(o),h=this.getVerticalCoord(d,n,s);e.push({start:d,end:h,value:o,id:`sub-tick-${o}`})}}return e}_getTickLineAttribute(t,e,s,n){let a=i.get(this.attribute,`${t}.style`);const r=this.data[s];a=i.isFunction(a)?i.merge({},i.get(Bt,`${t}.style`),"tick"===t?a(r.rawValue,s,r,this.data):a(e.value,s,e,n)):a;const{start:l,end:o,anchor:d,alpha:h,beta:u}=e;return Object.assign({points:[l,o],anchor:d,alpha:h,beta:u},a)}_getLabelAttribute(t,e,s,n){var a,r,l,d,h,u;const c=this.attribute.label,{space:b=4,inside:g=!1,formatMethod:p}=c,v=o(c,["space","inside","formatMethod"]);let m=b,_=0;(null===(a=this.attribute.tick)||void 0===a?void 0:a.visible)&&(null===(r=this.attribute.tick)||void 0===r?void 0:r.inside)===g&&(_=(null===(l=this.attribute.tick)||void 0===l?void 0:l.length)||4),(null===(d=this.attribute.subTick)||void 0===d?void 0:d.visible)&&(null===(h=this.attribute.subTick)||void 0===h?void 0:h.inside)===g&&(_=Math.max(_,(null===(u=this.attribute.subTick)||void 0===u?void 0:u.length)||2)),m+=_;const y=this.getRelativeVector(t.point);n>0&&(0===y[1]?m+=(this.axisLabelLayerSize[n-1].height+i.get(this.attribute,"label.space",4))*n:m+=(this.axisLabelLayerSize[n-1].width+i.get(this.attribute,"label.space",4))*n);const x=this.getVerticalCoord(t.point,m,g),f=this.getVerticalVector(m,g,x),A=p?p(`${t.label}`,t,e,s,n):t.label;let{style:S}=v;S=i.isFunction(S)?i.merge({},Bt.label.style,S(t,e,s,n)):S;const E=this.getLabelAlign(f,g,S.angle);return S=i.merge(E,S),i.isFunction(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},x),{text:A,lineHeight:null==S?void 0:S.fontSize}),S)}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}}const Tt={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&Ct(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Ct(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function Pt(t,e){for(let i,s=1,n=t.length,a=t[0].AABBBounds;s<n;a=i,++s)if(Ct(a,i=t[s].AABBBounds,e))return!0}function Ot(t){const e=t.AABBBounds;return e.width()>1&&e.height()>1}function It(t){for(let n=1;n<t.length;n++)if(e=t[n-1],s=t[n],i.isRotateAABBIntersect(e.rotatedBounds,s.rotatedBounds,!0))return!0;var e,s;return!1}function Ht(t,e){"bottom"!==t&&"top"!==t||function(t,e){e.forEach((e=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},zt(t,e.attribute.angle)),{angle:Vt(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},jt(t,e.attribute.angle)),{angle:Vt(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(s=e.centerX,n=e.centerY,a=e.angle,r=t.attribute.x,l=t.attribute.y,{x:(s-r)*Math.cos(a)+(n-l)*Math.sin(a)+r,y:(s-r)*Math.sin(a)+(l-n)*Math.cos(a)+l});var s,n,a,r,l;const o=i.x-e.centerX,d=i.y-e.centerY;e.x1+=o,e.x2+=o,e.y1+=d,e.y2+=d,e.centerX+=o,e.centerY+=d,t.rotatedBounds=e}))}(e)}function Vt(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function zt(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Vt(e))/(.5*Math.PI);let a;return a=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[a],textBaseline:s[a]}}function jt(t,e=0){let i=["right","right","center","left","center","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],s=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Vt(e))/(.5*Math.PI);let a;return a=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[a],textBaseline:s[a]}}class Rt{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){const[e,i]=t;let s=e*e+i*i;return s>0&&(s=1/Math.sqrt(s)),[t[0]*s,t[1]*s]}(this.getRelativeVector());return x([n[1],-1*n[0]],t*(e?1:-1)*s)}}class Nt extends wt{constructor(t,e){super(i.merge({},Nt.defaultAttributes,t),e),"3d"===e&&this.setMode(e)}_renderInner(s){var n;super._renderInner(s);const{panel:a}=this.attribute;if(a&&a.visible){const s=this.axisContainer,r=s.AABBBounds,l=e.createRect(Object.assign({x:r.x1,y:r.y1,width:r.width(),height:r.height()},a.style));l.name=t.AXIS_ELEMENT_NAME.background,l.id=this._getNodeId("background"),l.states=i.merge({},Mt,null!==(n=a.state)&&void 0!==n?n:{}),s.insertBefore(l,s.firstChild)}}renderLine(e){const{start:s,end:n,line:a}=this.attribute,r=a,{startSymbol:l,endSymbol:d,style:h,breakRange:u,breakShape:c,breakShapeStyle:b,state:g}=r,p=o(r,["startSymbol","endSymbol","style","breakRange","breakShape","breakShapeStyle","state"]),v=Object.assign({points:[s,n],startSymbol:l,endSymbol:d,lineStyle:h},p);i.isEmpty(g)||(v.state={line:i.merge({},Mt,g),symbol:i.merge({},Mt,g)});const m=new Et(v);m.name=t.AXIS_ELEMENT_NAME.line,m.id=this._getNodeId("line"),e.add(m)}getTitleAttribute(){var t,e,s,n,a,r,l,d;const h=this.attribute.title,{position:u="middle",space:c=4,textStyle:b={},autoRotate:g=!0,shape:p,background:v,state:m}=h,_=o(h,["position","space","textStyle","autoRotate","shape","background","state"]);let y=.5;"start"===u?y=0:"end"===u&&(y=1);const{verticalFactor:x=1}=this.attribute,A=-1*x,S=this.getTickCoord(y),E=this.getRelativeVector();let L=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+i.get(this.attribute,"label.space",4);L+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===E[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?L+=i+(e-1)*t:L=0}else{if(0===E[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?L+=i+(e-1)*t:L=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{L+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,n="center"===i,a=E[1]>0;L=1===A?a?s?L:n?L/2:t:s?t:n?L/2:L:a?s?t:n?L/2:L:s?L:n?L/2:t}}let k=0;(null===(s=this.attribute.tick)||void 0===s?void 0:s.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(k=(null===(a=this.attribute.tick)||void 0===a?void 0:a.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(l=this.attribute.subTick)||void 0===l?void 0:l.inside)&&(k=Math.max(k,(null===(d=this.attribute.subTick)||void 0===d?void 0:d.length)||2));const M=k+L+c,B=this.getVerticalCoord(S,M,!1),w=this.getVerticalVector(M,!1,{x:0,y:0});let T,C,{angle:P}=_;if(T="start"===u?"start":"end"===u?"end":"center",i.isNil(P)&&g){P=f(E,[1,0],!0);const{verticalFactor:t=1}=this.attribute;C=1===-1*t?"bottom":"top"}else T=this.getTextAlign(w),C=this.getTextBaseline(w,!1);const O=Object.assign(Object.assign(Object.assign({},B),_),{textStyle:Object.assign({textAlign:T,textBaseline:C},b),state:{text:i.merge({},Mt,null==m?void 0:m.text),shape:i.merge({},Mt,null==m?void 0:m.shape),panel:i.merge({},Mt,null==m?void 0:m.background)}});return O.angle=P,p&&p.visible&&(O.shape=Object.assign({visible:!0},p.style),p.space&&(O.space=p.space)),v&&v.visible&&(O.panel=Object.assign({visible:!0},v.style)),O}getTextBaseline(t,e){let s="middle";const{verticalFactor:n=1}=this.attribute,a=(e?1:-1)*n;return i.isNumberClose(t[1],0)?s=!i.isNumberClose(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===a?"bottom":"top":t[1]>0?s="top":t[1]<0&&(s="bottom"),s}getLabelAlign(t,e,s){const n=this.attribute.orient;if(i.isValidNumber(s)){if("top"===n||"bottom"===n)return zt(n,s);if("left"===n||"right"===n)return jt(n,s)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,s,n,a){const{flush:r=!1}=this.attribute.label||{};if(r&&t.length){const{orient:e,start:s,end:n}=this.attribute,a="bottom"===e||"top"===e,r=t[0],l=i.last(t),o=a?r.attribute.x>l.attribute.x:r.attribute.y<l.attribute.y;if(a){const t=Math.abs(s.x-n.x);if(o){const e=t,i=0,s=r.AABBBounds.x2,n=l.AABBBounds.x1;s>e&&r.setAttributes({x:e,textAlign:"right"}),n<i&&l.setAttributes({x:i,textAlign:"left"})}else{const e=0,i=t,s=r.AABBBounds.x1,n=l.AABBBounds.x2;s<e&&r.setAttributes({x:e,textAlign:"left"}),n>i&&l.setAttributes({x:i,textAlign:"right"})}}else{const t=Math.abs(s.y-n.y);if(o){const e=r.AABBBounds.y1,i=l.AABBBounds.y2,s=0,n=t;e<s&&r.setAttributes({y:s,textBaseline:"top"}),i>n&&l.setAttributes({y:n,textBaseline:"bottom"})}else{const e=t,i=0,s=r.AABBBounds.y2,n=l.AABBBounds.y1;s>e&&r.setAttributes({y:e,textBaseline:"bottom"}),n<i&&l.setAttributes({y:i,textBaseline:"top"})}}}}handleLabelsOverlap(t,e,s,n,a){if(i.isEmpty(t))return;const{verticalLimitSize:r,label:l,orient:o}=this.attribute,d=this._getAxisLabelLimitLength(r,a),{layoutFunc:h,autoRotate:u,autoRotateAngle:c,autoLimit:b,limitEllipsis:g,autoHide:p,autoHideMethod:v,autoHideSeparation:m}=l;i.isFunction(h)?h(t,e,n,this):(u&&function(t,e){if(i.isEmpty(t))return;const{orient:s,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let a=0,r=0;for(n&&n.length>0&&(r=n.length);a<r;){const e=n[a++];if(t.forEach((t=>{t.attribute.angle=i.degreeToRadian(e)})),Ht(s,t),!It(t))break}}(t,{labelRotateAngle:c,orient:o}),b&&i.isValidNumber(d)&&d>0&&function(t,e){const{limitLength:s,ellipsis:n="...",orient:a}=e;!i.isEmpty(t)&&i.isValidNumber(s)&&t.forEach((t=>{if(("top"===a||"bottom"===a)&&Math.floor(t.AABBBounds.height())<=s)return;if(("left"===a||"right"===a)&&Math.floor(t.AABBBounds.width())<=s)return;let e=0===t.attribute.angle||i.isNil(t.attribute.angle)?"top"===a||"bottom"===a?null:s:Math.abs(s/Math.sin(t.attribute.angle));i.isValidNumber(t.attribute.maxLineWidth)&&(e=i.isValidNumber(e)?Math.min(t.attribute.maxLineWidth,e):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:e,ellipsis:t.attribute.ellipsis||n})}))}(t,{limitLength:d,ellipsis:g,orient:o}),p&&function(t,e){if(i.isEmpty(t))return;const s=t.filter(Ot);if(i.isEmpty(s))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(s);const{method:a="parity",separation:r=0}=e,l=i.isFunction(a)?a:Tt[a]||Tt.parity;if(n.length>=3&&Pt(n,r)){do{n=l(n,r)}while(n.length>=3&&Pt(n,r));n.length<3&&!i.last(s).attribute.opacity&&(n.length>1&&i.last(n).setAttribute("opacity",0),i.last(s).setAttribute("opacity",1))}s.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:v,separation:m}))}afterLabelsOverlap(s,n,a,r,l){const{verticalLimitSize:o,orient:d}=this.attribute,h="bottom"===d||"top"===d,u=a.AABBBounds;let c=h?u.height():u.width();const{verticalMinSize:b}=this.attribute;if(i.isValidNumber(b)&&(!i.isValidNumber(o)||b<=o)){const i=this._getAxisLabelLimitLength(b,l);let s,n;c=Math.max(c,i),"left"===d?(s=u.x2-c,n=u.y1):"right"===d?(s=u.x1,n=u.y1):"top"===d?(s=u.x1,n=u.y2-c):"bottom"===d&&(s=u.x1,n=u.y1);const r=e.createRect({x:s,y:n,width:h?u.width():c,height:h?c:u.height(),pickable:!1});r.name=t.AXIS_ELEMENT_NAME.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),a.insertBefore(r,a.firstChild)}if(i.isValid(this.attribute.label.containerAlign)){let t;"left"===d?t=u.x2:"right"===d?t=u.x1:"top"===d?t=u.y2:"bottom"===d&&(t=u.y1),function(t,e,i,s,n){if("right"===s||"left"===s){if("left"===n){const n="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"left"})}))}else if("right"===n){const n="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"right"})}))}else if("center"===n){const n="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===n){const n="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})}))}else if("bottom"===n){const n="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})}))}else if("middle"===n){const n="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})}))}}(s,t,c,d,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var s,n,a;const{label:r,title:l,line:o,tick:d}=this.attribute,h=null!==(s=r.space)&&void 0!==s?s:4;let u=t,c=0,b=0;const g=(null==o?void 0:o.visible)?null!==(n=o.style.lineWidth)&&void 0!==n?n:1:0,p=(null==d?void 0:d.visible)?null!==(a=d.length)&&void 0!==a?a:4:0;if(null==l?void 0:l.visible){c=B(l.text,l.textStyle).height;const t=i.normalizePadding(l.padding);b=l.space+t[0]+t[2]}return u&&(u=(u-h-b-c-g-p)/e),u}}Nt.defaultAttributes=Bt,i.mixin(Nt,Rt);class Dt{isInValidValue(t){const{startAngle:e=A,endAngle:i=S}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=A,endAngle:s=S,center:n,radius:a,inside:r=!1,innerRadius:l=0}=this.attribute,o=e+(s-e)*t;return i.polarToCartesian(n,r&&l>0?l:a,o)}getVerticalVector(t,e=!1,i){const{inside:s=!1}=this.attribute,{center:n}=this.attribute,a=[i.x-n.x,i.y-n.y];return x(a,(e?-1:1)*(s?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(a))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}class $t extends wt{constructor(t){super(i.merge({},$t.defaultAttributes,t))}renderLine(s){const{startAngle:n=A,endAngle:a=S,radius:r,center:l,innerRadius:o=0,line:d,inside:h=!1}=this.attribute;let u=r,c=o;h&&o>0&&(u=o,c=0);const b=Object.assign(Object.assign(Object.assign({},l),{startAngle:n,endAngle:a,radius:u,innerRadius:c}),null==d?void 0:d.style),g=e.createCircle(b);g.name=t.AXIS_ELEMENT_NAME.line,g.id=this._getNodeId("line"),i.isEmpty(null==d?void 0:d.state)||(g.states=i.merge({},Mt,d.state)),s.add(g)}getTitleAttribute(){var t,e,s,n,a,r,l,d;const{center:h,radius:u,innerRadius:c=0}=this.attribute,b=this.attribute.title,{space:g=4,textStyle:p={},shape:v,background:m,state:_}=b,y=o(b,["space","textStyle","shape","background","state"]);let x=h,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(f=i.get(this.attribute.label,"style.fontSize",12)+i.get(this.attribute.label,"space",4));let A=0;(null===(s=this.attribute.tick)||void 0===s?void 0:s.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(a=this.attribute.tick)||void 0===a?void 0:a.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(l=this.attribute.subTick)||void 0===l?void 0:l.inside)&&(A=Math.max(A,(null===(d=this.attribute.subTick)||void 0===d?void 0:d.length)||2));const S=u+A+f+g;let E="middle",{position:L}=this.attribute.title;i.isNil(L)&&(L=0===c?"end":"middle"),"start"===L?(E="bottom",x={x:h.x,y:h.y-S}):"end"===L&&(E="top",x={x:h.x,y:h.y+S});const k=Object.assign(Object.assign(Object.assign({},x),y),{textStyle:Object.assign({textBaseline:E,textAlign:"center"},p),state:{text:i.merge({},Mt,null==_?void 0:_.text),shape:i.merge({},Mt,null==_?void 0:_.shape),panel:i.merge({},Mt,null==_?void 0:_.background)}}),{angle:M}=y;return k.angle=M,v&&v.visible&&(k.shape=Object.assign({visible:!0},v.style),v.space&&(k.space=v.space)),m&&m.visible&&(k.panel=Object.assign({visible:!0},m.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:a=!1,length:r=2}=i,l=this.tickLineItems,o=l.length;if(o>=2){const i=this.data[1].value-this.data[0].value,d=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t<o;t++){const e=l[t],o=l[t+1];for(let t=0;t<n;t++){const l=(t+1)/(n+1),h=(1-l)*e.value+l*(o?o.value:d?1:e.value+i),u=this.getTickCoord(h),c=this.getVerticalCoord(u,r,a);s.push({start:u,end:c,value:h})}}}return s}getTextBaseline(t){let e="middle";return i.isNumberClose(t[1],0)?e="middle":t[1]>0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,s,n){}handleLabelsOverlap(t,e,i,s,n){}afterLabelsOverlap(t,e,i,s,n){}getLabelAlign(t,e,i){return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t)}}}$t.defaultAttributes=Bt,i.mixin($t,Dt);class Wt extends e.ACustomAnimate{constructor(){super(...arguments),this.mode=e.AnimateMode.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return u(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},u(t,(t=>{var e,s,n,a,r,l;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!i.isEqual(t.attribute,o.attribute)){const a=i.cloneDeep(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},a),{opacity:null!==(e=a.opacity)&&void 0!==e?e:1,fillOpacity:null!==(s=a.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=a.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(a=t.attribute.opacity)&&void 0!==a?a:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(l=t.attribute.strokeOpacity)&&void 0!==l?l:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((s=>{var n,a,r,l,o,d,h;const{node:u,attrs:c,state:b}=this._newElementAttrMap[s];"enter"===b&&(t=i.isValidNumber(null===(a=null===(n=this.params)||void 0===n?void 0:n.enter)||void 0===a?void 0:a.duration)?null===(r=this.params)||void 0===r?void 0:r.enter.duration:t,e=(null===(o=null===(l=this.params)||void 0===l?void 0:l.enter)||void 0===o?void 0:o.easing)?null===(h=null===(d=this.params)||void 0===d?void 0:d.enter)||void 0===h?void 0:h.easing:e),"path"===u.type?u.animate({interpolate:(t,e,s,n,a)=>"path"===t&&(a.path=i.interpolateString(s,n)(e),!0)}).to(c,t,e):u.animate().to(c,t,e)}))}onUpdate(t,e,i){}}class Ut extends e.ACustomAnimate{constructor(t,e,i,s){super(null,null,i,s)}getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}}class Ft extends e.ACustomAnimate{constructor(t,e,i,s){super(null,null,i,s)}getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}function Gt(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function Yt(t,e,s,n){let a="";if(!t||0===e.length)return a;const r=e[0],l=i.PointService.distancePP(t,r),o=s?0:1;return n?a+=`M${t.x},${t.y-l}A${l},${l},0,0,${o},${t.x},${t.y+l}A${l},${l},0,0,${o},${t.x},${t.y-l}Z`:e.forEach(((t,e)=>{0===e?a=`M${t.x},${t.y}`:a+=`A${l},${l},0,0,${o},${t.x},${t.y}`})),a}function Xt(t,e,s){const{type:n,closed:a}=s,r=e.slice(0).reverse();let l="",o="";if("line"===n&&s.smoothLink&&s.center){const e=t[0],n=r[0],d=s.center;l=Gt(t,!!a),o=Gt(r,!!a);const h=i.PointService.distancePP(n,d),u=i.PointService.distancePP(e,d);l+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${u},${u},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=s;l=Yt(e,t,!1,!!a),o=Yt(e,r,!0,!!a)}else"line"!==n&&"polygon"!==n||(l=Gt(t,!!a),o=Gt(r,!!a));return a?l+=o:(o="L"+o.substring(1),l+=o,l+="Z"),l}class qt extends a{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=e.createGroup({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:i}=this.attribute;t&&t.length&&!1!==i&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){const s=this.getVerticalVector(e,i,t);return{x:t.x+s[0],y:t.y+s[1]}}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(s,n){const a=i.merge({},this.attribute,this.getGridAttribute(s)),{type:r,items:l,style:o,closed:d,alternateColor:h,depth:u=0}=a,c=s?`${t.AXIS_ELEMENT_NAME.grid}-sub`:`${t.AXIS_ELEMENT_NAME.grid}`;if(l.forEach(((t,s)=>{const{id:a,points:l}=t;let h="";if("line"===r||"polygon"===r)h=Gt(l,!!d);else if("circle"===r){const{center:t}=this.attribute;h=Yt(t,l,!1,!!d)}const b=e.createPath(Object.assign({path:h,z:u},i.isFunction(o)?i.merge({},qt.defaultAttributes.style,o(t,s)):o));b.name=`${c}-line`,b.id=this._getNodeId(`${c}-path-${a}`),n.add(b)})),u&&"line"===r&&l.forEach(((t,s)=>{const{id:a,points:r}=t,l=[];l.push(r[0]);const h=r[1].x-r[0].x,b=r[1].y-r[0].y,g=Math.sqrt(h*h+b*b),p=u/g;l.push({x:r[0].x+h*p,y:r[0].y+b*p});const v=Gt(l,!!d),m=i.abs(l[0].x-l[1].x),_=i.abs(l[0].y-l[1].y),y=e.createPath(Object.assign({path:v,z:0,alpha:m>_?(r[1].x-r[0].x>0?-1:1)*i.pi/2:0,beta:m<_?-i.pi/2:0,anchor3d:m>_?[l[0].x,0]:[0,l[0].y]},i.isFunction(o)?i.merge({},qt.defaultAttributes.style,o(t,s)):o));y.name=`${c}-line`,y.id=this._getNodeId(`${c}-path-${a}`),n.add(y)})),l.length>1&&h){const t=i.isArray(h)?h:[h,"transparent"],s=e=>t[e%t.length];for(let t=0;t<l.length-1;t++){const[i,r]=[l[t].points,l[t+1].points],o=Xt(i,r,a),d=e.createPath({path:o,fill:s(t)});d.name=`${c}-region`,d.id=this._getNodeId(`${c}-region-${t}`),n.add(d)}}}_getNodeId(t){return`${this.id}-${t}`}}qt.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class Zt extends qt{constructor(t,e){super(i.merge({},qt.defaultAttributes,t),e),"3d"===e&&this.setMode(e)}_getGridPoint(t,e){let s;if("line"===t){const{length:t}=this.attribute;s=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n=6,startAngle:a=A,endAngle:r=S}=this.attribute;s=function(t,e,s,n,a){const r=[],l=a-n;for(let a=0;a<e;a++){const o=n+a*l/e;r.push(i.polarToCartesian(t,s,o))}return r}(t,n,i.PointService.distancePP(t,e),a,r)}return s}getGridAttribute(t){const{type:e,alignWithLabel:s=!0}=this.attribute;let n=1;let a;this.data.length>=2&&(n=this.data[1].value-this.data[0].value);let r=[];if(t){a=i.merge({},this.attribute,this.attribute.subGrid);const t=[],{count:l=4}=this.attribute.subGrid||{};if(this.data.length>=2){const i=[];this.data.forEach((t=>{let e=t.value;if(!s){const i=t.value-n/2;if(this.isInValidValue(i))return;e=i}i.push({value:e})}));for(let s=0;s<i.length-1;s++){const n=i[s],a=i[s+1];t.push({id:`sub-${s}-0`,points:this._getGridPoint(e,this.getTickCoord(n.value)),datum:{}});for(let i=0;i<l;i++){const r=(i+1)/(l+1),o=(1-r)*n.value+r*a.value,d=this.getTickCoord(o);t.push({id:`sub-${s}-${i+1}`,points:this._getGridPoint(e,d),datum:{}})}s===i.length-2&&t.push({id:`sub-${s}-${l+1}`,points:this._getGridPoint(e,this.getTickCoord(a.value)),datum:{}})}r=t}}else{a=this.attribute;const t=[];this.data.forEach((i=>{let{point:a}=i;if(!s){const t=i.value-n/2;if(this.isInValidValue(t))return;a=this.getTickCoord(t)}t.push({id:i.label,datum:i,points:this._getGridPoint(e,a)})})),r=t}return Object.assign(Object.assign({},a),{items:r})}}i.mixin(Zt,Rt);class Jt extends qt{constructor(t){super(i.merge({},qt.defaultAttributes,t))}getGridAttribute(t){let e,s=[];const n=this.attribute,{radius:a,innerRadius:r=0,startAngle:l=A,endAngle:d=S,center:h,subGrid:u}=n,c=o(n,["radius","innerRadius","startAngle","endAngle","center","subGrid"]),{alignWithLabel:b=!0}=c||{},g=a-r;let p=1;if(this.data.length>=2&&(p=this.data[1].value-this.data[0].value),t){e=i.merge({},c,u);const t=[],{count:n=4}=u||{},a=this.data.length;if(a>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!b){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i<a;i++){const s=e[i],a=e[i+1];t.push({id:`sub-${i}-0`,points:[this.getTickCoord(s.value),this.getVerticalCoord(this.getTickCoord(s.value),g,!0)],datum:{}});for(let e=0;e<n;e++){const r=(e+1)/(n+1),l=(1-r)*s.value+r*(a?a.value:b?1:s.value+p),o=this.getTickCoord(l),d=this.getVerticalCoord(o,g,!0);t.push({id:`sub-${i}-${e+1}`,points:[o,d],datum:{}})}}Math.abs(d-l)%(2*Math.PI)==0&&t.push(t[0]),s=t}}else{e=c;const t=[];let i;i=Math.abs(d-l)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,i.forEach((e=>{let{point:i}=e;if(!b){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,g,!0);t.push({id:e.id,points:[i,s],datum:e})})),s=t}return Object.assign(Object.assign({},e),{items:s,center:h,type:"line"})}}var Kt;i.mixin(Jt,Dt),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(Kt||(Kt={}));class Qt extends a{constructor(t){super(i.merge({},Qt.defaultAttributes,t)),this.name="dataZoom",this._previewData=[],this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",max:0},this.state={start:0,end:1},this._statePointToData=t=>t,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=Kt.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=Kt.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=Kt.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=Kt.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=Kt.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:s}=this.attribute,n=this.eventPosToStagePos(t),{attPos:a,max:r}=this._layoutCache,l=(n[a]-this._activeCache.lastPos[a])/r;this._activeState&&(this._activeTag===Kt.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===Kt.startHandler?this.state.start+l>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+l,this._activeTag=Kt.endHandler):this.state.start=this.state.start+l:this._activeTag===Kt.endHandler&&(this.state.end+l<this.state.start?(this.state.end=this.state.start,this.state.start=this.state.end+l,this._activeTag=Kt.startHandler):this.state.end=this.state.end+l),this._activeCache.lastPos=n,s&&this.renderDragMask()),this.state.start=Math.min(Math.max(this.state.start,0),1),this.state.end=Math.min(Math.max(this.state.end,0),1),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end),this._dispatchChangeEvent(this.state.start,this.state.end))};const{start:e,end:s,size:n,orient:a,showDetail:r,position:l,previewData:o,previewCallbackX:d,previewCallbackY:h,previewCallbackX1:u,previewCallbackY1:c,updateStateCallback:b}=this.attribute,{width:g,height:p}=n;e&&(this.state.start=e),s&&(this.state.end=s),this._isHorizontal="top"===a||"bottom"===a,this._layoutCache.max=this._isHorizontal?g:p,this._layoutCache.attPos=this._isHorizontal?"x":"y",this._layoutCache.attSize=this._isHorizontal?"width":"height",this._activeCache.startPos=l,this._activeCache.lastPos=l,this._showText="auto"!==r&&r,o&&(this._previewData=o),i.isFunction(d)&&(this._previewCallbackX=d),i.isFunction(h)&&(this._previewCallbackY=h),i.isFunction(u)&&(this._previewCallbackX1=u),i.isFunction(c)&&(this._previewCallbackY1=c),i.isFunction(b)&&(this._updateStateCallback=b)}bindEvents(){const{showDetail:t,brushSelect:i}=this.attribute;this._startHandler&&this._startHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const s=i?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,s))),i&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),i&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,s))),"browser"===e.vglobal.env&&(e.vglobal.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),e.vglobal.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,s;const n=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==n?void 0:n.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==n?void 0:n.top)||0)-((null===(s=this.stage)||void 0===s?void 0:s.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:s}=this.attribute;if(this._activeState&&this._activeTag===Kt.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end),this._dispatchChangeEvent(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,a=t[i]-n[i],r=e[i]-n[i],l=Math.min(Math.max(Math.min(a,r)/s,0),1),o=Math.min(Math.max(Math.max(a,r)/s,0),1);Math.abs(l-o)<.01?this.moveZoomWithMiddle(l):(this.state.start=l,this.state.end=o)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:s,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:i.clamp(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+s),y:e.y,width:this._activeState&&this._activeTag===Kt.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:i.clamp(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:s,height:this._activeState&&this._activeTag===Kt.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:s}=t,n=o(t,["formatMethod"]),{formatMethod:a}=e,r=o(e,["formatMethod"]),{start:l,end:d}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(d);const{position:h,width:u,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,i.merge({},n,{text:s?s(this._startValue):this._startValue,x:h.x+l*u,y:h.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${h}`),this._endText=this.maybeAddLabel(this._container,i.merge({},r,{text:a?a(this._endValue):this._endValue,x:h.x+d*u,y:h.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${h}`)):(this._startText=this.maybeAddLabel(this._container,i.merge({},n,{text:s?s(this._startValue):this._startValue,x:h.x+u/2,y:h.y+l*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${h}`),this._endText=this.maybeAddLabel(this._container,i.merge({},r,{text:a?a(this._endValue):this._endValue,x:h.x+u/2,y:h.y+d*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${h}`))}getLayoutAttrFromConfig(){var t,e,i,s;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:n,size:a,orient:r,middleHandlerStyle:l,startHandlerStyle:o,endHandlerStyle:d}=this.attribute,{width:h,height:u}=a,c=null!==(e=null===(t=null==l?void 0:l.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let b,g,p;(null==l?void 0:l.visible)?this._isHorizontal?(b=h,g=u-c,p={x:n.x,y:n.y+c}):(b=h-c,g=u,p={x:n.x+("left"===r?c:0),y:n.y}):(b=h,g=u,p=n);const v=null!==(i=null==o?void 0:o.size)&&void 0!==i?i:this._isHorizontal?g:b,m=null!==(s=null==d?void 0:d.size)&&void 0!==s?s:this._isHorizontal?g:b;return(null==o?void 0:o.visible)&&(this._isHorizontal?(b-=(v+m)/2,p={x:p.x+v/2,y:p.y}):(g-=(v+m)/2,p={x:p.x,y:p.y+v})),this._layoutAttrFromConfig={position:p,width:b,height:g},this._layoutAttrFromConfig}render(){var t,e,i,s,n,a,r,l,o,d,h,u,c,b,g,p,v,m,_,y,x;this._layoutAttrFromConfig=null;const{orient:f,backgroundStyle:A,backgroundChartStyle:S,selectedBackgroundStyle:E,selectedBackgroundChartStyle:L,middleHandlerStyle:k,startHandlerStyle:M,endHandlerStyle:B,brushSelect:w}=this.attribute,{start:T,end:C}=this.state,{position:P,width:O,height:I}=this.getLayoutAttrFromConfig(),H=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=H,this._background=H.createOrUpdateChild("background",Object.assign({x:P.x,y:P.y,width:O,height:I,cursor:w?"crosshair":"auto"},A),"rect"),(null===(t=null==S?void 0:S.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",H),(null===(e=null==S?void 0:S.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",H),w&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=H.createOrUpdateChild("selectedBackground",Object.assign({x:P.x+T*O,y:P.y,width:(C-T)*O,height:I,cursor:w?"crosshair":"move"},E),"rect"):this._selectedBackground=H.createOrUpdateChild("selectedBackground",Object.assign({x:P.x,y:P.y+T*I,width:O,height:(C-T)*I,cursor:w?"crosshair":"move"},E),"rect"),(null===(i=null==L?void 0:L.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",H),(null===(s=null==L?void 0:L.area)||void 0===s?void 0:s.visible)&&this.setSelectedPreviewAttributes("area",H),this.renderText(),this._isHorizontal?(this._startHandler=H.createOrUpdateChild("startHandler",Object.assign({x:P.x+T*O,y:P.y+I/2,size:I,angle:0,symbolType:null!==(n=null==M?void 0:M.symbolType)&&void 0!==n?n:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},M),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign({x:P.x+C*O,y:P.y+I/2,size:I,angle:0,symbolType:null!==(a=null==B?void 0:B.symbolType)&&void 0!==a?a:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},B),"symbol"),(null==k?void 0:k.visible)&&(this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign({x:P.x+T*O,y:P.y-((null===(r=null==k?void 0:k.background)||void 0===r?void 0:r.size)||10),width:(C-T)*O,height:(null===(l=null==k?void 0:k.background)||void 0===l?void 0:l.size)||10},null===(o=null==k?void 0:k.background)||void 0===o?void 0:o.style),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:P.x+(T+C)/2*O,y:P.y-((null===(d=null==k?void 0:k.background)||void 0===d?void 0:d.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(u=null===(h=null==k?void 0:k.icon)||void 0===h?void 0:h.symbolType)&&void 0!==u?u:"square"},null==k?void 0:k.icon),"symbol"))):(this._startHandler=H.createOrUpdateChild("startHandler",Object.assign({x:P.x+O/2,y:P.y+T*I,size:O,angle:Math.PI/180*90,symbolType:null!==(c=null==M?void 0:M.symbolType)&&void 0!==c?c:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},M),"symbol"),(null==k?void 0:k.visible)&&(this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===f?P.x-((null===(b=null==k?void 0:k.background)||void 0===b?void 0:b.size)||10):P.x+O,y:P.y+T*I,width:(null===(g=null==k?void 0:k.background)||void 0===g?void 0:g.size)||10,height:(C-T)*I},null===(p=null==k?void 0:k.background)||void 0===p?void 0:p.style),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===f?P.x-((null===(v=null==k?void 0:k.background)||void 0===v?void 0:v.size)||10)/2:P.x+O+((null===(m=null==k?void 0:k.background)||void 0===m?void 0:m.size)||10)/2,y:P.y+(T+C)/2*I,angle:Math.PI/180*90,symbolType:null!==(y=null===(_=null==k?void 0:k.icon)||void 0===_?void 0:_.symbolType)&&void 0!==y?y:"square",strokeBoundsBuffer:0},null==k?void 0:k.icon),"symbol")),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign({x:P.x+O/2,y:P.y+C*I,size:O,angle:Math.PI/180*90,symbolType:null!==(x=null==B?void 0:B.symbolType)&&void 0!==x?x:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},B),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,a;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],a=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],a=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],a=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:a}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i}=this.attribute,{start:s,end:n}=this.state,{position:a,width:r,height:l}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?a.x+s*r:a.x,y:this._isHorizontal?a.y:a.y+s*l,width:this._isHorizontal?(n-s)*r:r,height:this._isHorizontal?l:(n-s)*l,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?a.x+s*r:a.x),y:-(this._isHorizontal?a.y:a.y+s*l),width:this._isHorizontal?(n-s)*r:r,height:this._isHorizontal?l:(n-s)*l,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new w(e),s.name=i),t.add(s),s}_dispatchChangeEvent(t,i){var s;const n=new e.CustomEvent("change",{start:t,end:i});n.manager=null===(s=this.stage)||void 0===s?void 0:s.eventSystem.manager,this.dispatchEvent(n)}setStartAndEnd(t,e){const{start:s,end:n}=this.attribute;i.isValid(t)&&i.isValid(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,s===this.state.start&&n===this.state.end||(this.setAttributes({start:t,end:e}),this._updateStateCallback&&this._updateStateCallback(t,e),this._dispatchChangeEvent(t,e)))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,s,n;const{middleHandlerStyle:a}=this.attribute,r=null!==(e=null===(t=null==a?void 0:a.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,l=null!==(n=null===(s=null==a?void 0:a.icon)||void 0===s?void 0:s.size)&&void 0!==n?n:10;return Math.max(r,...i.array(l))}setUpdateStateCallback(t){i.isFunction(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){i.isFunction(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){i.isFunction(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){i.isFunction(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){i.isFunction(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){i.isFunction(t)&&(this._statePointToData=t)}}var te,ee,ie;Qt.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},t.IMarkLineLabelPosition=void 0,(te=t.IMarkLineLabelPosition||(t.IMarkLineLabelPosition={})).start="start",te.middle="middle",te.end="end",te.insideStartTop="insideStartTop",te.insideStartBottom="insideStartBottom",te.insideMiddleTop="insideMiddleTop",te.insideMiddleBottom="insideMiddleBottom",te.insideEndTop="insideEndTop",te.insideEndBottom="insideEndBottom",t.IMarkAreaLabelPosition=void 0,(ee=t.IMarkAreaLabelPosition||(t.IMarkAreaLabelPosition={})).left="left",ee.right="right",ee.top="top",ee.bottom="bottom",ee.middle="middle",ee.insideLeft="insideLeft",ee.insideRight="insideRight",ee.insideTop="insideTop",ee.insideBottom="insideBottom",t.IMarkPointItemPosition=void 0,(ie=t.IMarkPointItemPosition||(t.IMarkPointItemPosition={})).top="top",ie.bottom="bottom",ie.middle="middle",ie.insideTop="insideTop",ie.insideBottom="insideBottom",ie.insideMiddle="insideMiddle";class se extends a{constructor(){super(...arguments),this.name="marker"}_initContainer(){var t,i;const{limitRect:s,clipInRange:n}=this.attribute;let a;if(n){const n=e.createGroup(Object.assign(Object.assign({},s),{clip:!0,pickable:!1}));a=e.createGroup({x:-(null!==(t=null==s?void 0:s.x)&&void 0!==t?t:0),y:-(null!==(i=null==s?void 0:s.y)&&void 0!==i?i:0)}),n.add(a),this._containerClip=n,this.add(n)}else a=e.createGroup({x:0,y:0}),this.add(a);a.name="marker-container",this._container=a}_updateContainer(){var t,e,i;const{limitRect:s,clipInRange:n}=this.attribute;null===(t=this._containerClip)||void 0===t||t.setAttributes(Object.assign({},s)),this._container.setAttributes({x:n?-(null!==(e=null==s?void 0:s.x)&&void 0!==e?e:0):0,y:n?-(null!==(i=null==s?void 0:s.y)&&void 0!==i?i:0):0})}render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i&&(this._container?(this._updateContainer(),this.updateMarker()):(this._initContainer(),this.initMarker(this._container)))}}const ne={startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:t.IMarkLineLabelPosition.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},ae={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},re={label:{position:t.IMarkAreaLabelPosition.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},le={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},oe={top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}};function de(t,e){const{x1:i,y1:s,x2:n,y2:a}=e,{x1:r,y1:l,x2:o,y2:d}=t.AABBBounds,{dx:h=0,dy:u=0}=t.attribute;let c=0,b=0;r<i&&(c=i-r),l<s&&(b=s-l),o>n&&(c=n-o),d>a&&(b=a-d),c&&t.setAttribute("dx",c+h),b&&t.setAttribute("dy",b+u)}class he extends se{constructor(t){super(i.merge({},he.defaultAttributes,t))}setLabelPos(){var t,e;const{label:i={},limitRect:s}=this.attribute,{position:n="end",refX:a=0,refY:r=0,confine:l}=i,o=this._line.getMainSegmentPoints(),d=null!==(t=this._line.getEndAngle())&&void 0!==t?t:0,h=a*Math.cos(d)+r*Math.cos(d-Math.PI/2),u=a*Math.sin(d)+r*Math.sin(d-Math.PI/2);let c;if(c=n.includes("start")||n.includes("Start")?{x:o[0].x+h,y:o[0].y+u}:n.includes("middle")||n.includes("Middle")?{x:(o[0].x+o[o.length-1].x)/2+h,y:(o[0].y+o[o.length-1].y)/2+u}:{x:o[o.length-1].x+h,y:o[o.length-1].y+u},this._label.setAttributes(Object.assign(Object.assign({},c),{angle:i.autoRotate?d+(null!==(e=null==i?void 0:i.refAngle)&&void 0!==e?e:0):0,textStyle:Object.assign(Object.assign({},ae[n]),i.textStyle)})),s&&l){const{x:t,y:e,width:i,height:n}=s;de(this._label,{x1:t,y1:e,x2:t+i,y2:e+n})}}initMarker(t){const{points:e,startSymbol:i,endSymbol:s,label:n,lineStyle:a,mainSegmentIndex:r,multiSegment:l}=this.attribute,o=new Et({points:e,startSymbol:i,endSymbol:s,lineStyle:a,mainSegmentIndex:r,multiSegment:l});o.name="mark-line-line",this._line=o,t.add(o);const d=new w(Object.assign({},n));d.name="mark-line-label",this._label=d,t.add(d),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:s,endSymbol:n,label:a,lineStyle:r,mainSegmentIndex:l,multiSegment:o}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:s,endSymbol:n,lineStyle:r,mainSegmentIndex:l,multiSegment:o}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({dx:0,dy:0},a)),this.setLabelPos()}}he.defaultAttributes=ne;class ue extends se{constructor(t){super(i.merge({},ue.defaultAttributes,t))}_getPositionByDirection(t,e){const{x1:i,x2:s,y1:n,y2:a}=this._area.AABBBounds;return e.includes("left")||e.includes("Left")?{x:i,y:(n+a)/2}:e.includes("right")||e.includes("Right")?{x:s,y:(n+a)/2}:e.includes("top")||e.includes("Top")?{x:(i+s)/2,y:n}:e.includes("bottom")||e.includes("Bottom")?{x:(i+s)/2,y:a}:{x:(i+s)/2,y:(n+a)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e}=this.attribute,i=null!==(t=null==e?void 0:e.position)&&void 0!==t?t:"middle",s=this._getPositionByDirection(this._area,i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},le[i]),e.textStyle)})),this.attribute.limitRect&&(null==e?void 0:e.confine)){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;de(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:i,label:s,areaStyle:n}=this.attribute,a=e.createPolygon(Object.assign({points:i},n));a.name="mark-area-area",this._area=a,t.add(a);const r=new w(Object.assign({},s));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:s,areaStyle:n}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},n)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({dx:0,dy:0},s)),this.setLabelPos()}}ue.defaultAttributes=re;class ce extends se{constructor(t){super(i.merge({},ce.defaultAttributes,t))}setLabelPos(){}setItemAttributes(e,i,s,n){var a;if(!e)return;const{autoRotate:r=!0,refX:l=0,refY:o=0,refAngle:d=0,textStyle:h,richTextStyle:u,imageStyle:c,position:b=t.IMarkPointItemPosition.middle}=i,g=(null===(a=this._line)||void 0===a?void 0:a.getEndAngle())||0,p=l*Math.cos(g)+o*Math.cos(g-Math.PI/2),v=l*Math.sin(g)+o*Math.sin(g-Math.PI/2);"text"===n?e.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},oe[(null==i?void 0:i.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?e.setAttributes({dx:this.getItemDx(e,b,u)+((null==u?void 0:u.dx)||0),dy:this.getItemDy(e,b,u)+((null==u?void 0:u.dy)||0)}):"image"===n&&e.setAttributes({dx:this.getItemDx(e,b,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(e,b,c)+((null==c?void 0:c.dy)||0)}),e.setAttributes({x:s.x+(p||0),y:s.y+(v||0),angle:r&&g+d})}getItemDx(t,e,i){var s,n;const a=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-a:0}getItemDy(t,e,i){var s,n;const a=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-a:e.includes("middle")||e.includes("Middle")?-a/2:0}initItem(t,i){const{type:s="text",symbolStyle:n,richTextStyle:a,imageStyle:r,renderCustomCallback:l}=t;let o;return"symbol"===s?o=e.createSymbol(Object.assign(Object.assign({},i),n)):"text"===s?o=new w(Object.assign({},i)):"richText"===s?o=e.createRichText(Object.assign(Object.assign({},i),a)):"image"===s?o=e.createImage(Object.assign(Object.assign({},i),r)):"custom"===s&&l&&(o=l()),this.setItemAttributes(o,t,i,s),o}getItemLineAttr(t,e,i){let s=[];const{type:n="type-s"}=t;return s="type-do"===n?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===n?[e,{x:i.x,y:e.y},i]:"type-op"===n?[e,{x:e.x,y:i.y},i]:[e,i],s}setItemLineAttr(t,e,i,s){var n;const{startSymbol:a,endSymbol:r,lineStyle:l}=t,o=this.getItemLineAttr(t,e,i);null===(n=this._line)||void 0===n||n.setAttributes({points:o,startSymbol:a,endSymbol:r,lineStyle:l,visible:s})}getDecorativeLineAttr(t,e){var i;const s=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,n=this._line.getEndAngle()||0;return{startPointOffsetX:s/2*Math.cos(n-Math.PI/2),startPointOffsetY:s/2*Math.sin(n-Math.PI/2),endPointOffsetX:-s/2*Math.cos(n-Math.PI/2),endPointOffsetY:-s/2*Math.sin(n-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var s;const{lineStyle:n}=t,{startPointOffsetX:a,startPointOffsetY:r,endPointOffsetX:l,endPointOffsetY:o}=this.getDecorativeLineAttr(t,e);null===(s=this._decorativeLine)||void 0===s||s.setAttributes(Object.assign(Object.assign({points:[{x:e.x+a,y:e.y+r},{x:e.x+l,y:e.y+o}]},n),{visible:i}))}initMarker(t){var i;const{position:s,itemLine:n,itemContent:a}=this.attribute,r={x:s.x+((null==a?void 0:a.offsetX)||0),y:s.y+((null==a?void 0:a.offsetY)||0)},l=new Et({points:[]});l.name="mark-point-line",this._line=l,t.add(l);const o=e.createLine({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,s,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(i=null==n?void 0:n.decorativeLine)||void 0===i?void 0:i.visible);const d=this.initItem(a,r);this._item=d,t.add(d)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:s}=this.attribute,{type:n="text"}=s,a={x:e.x+((null==s?void 0:s.offsetX)||0),y:e.y+((null==s?void 0:s.offsetY)||0)};this.setItemLineAttr(i,e,a,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,a,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,s,a,n)}}ce.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const be={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class ge extends a{getCurrent(){return this._current}constructor(t){super(i.merge({},ge.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{var i,s;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const s=new e.CustomEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t});s.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(s)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const i=new e.CustomEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t});i.manager=null===(s=this.stage)||void 0===s?void 0:s.eventSystem.manager,this.dispatchEvent(i)}this._current>1&&this.preHandler.removeState("disable"),this._current<this._total&&this.nextHandler.removeState("disable"),this.text.setAttribute("text",`${this._current}/${this._total}`)}}render(){var t;this._reset();const{layout:s="horizontal",handler:n=be,total:a,defaultCurrent:r=1,textStyle:l,padding:o=0}=this.attribute;this._current=r;const d=i.normalizePadding(o),h="horizontal"===s,u=e.createGroup({x:0,y:0}),c=n.style||{},b=c.size||15,g=null!==(t=n.space)&&void 0!==t?t:8,p=n.state||{};let{preShape:v,nextShape:m}=n;v||(v=h?"triangleLeft":"triangleUp"),m||(m=h?"triangleRight":"triangleDown");const _=e.createSymbol(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:0,y:0,symbolType:v,size:b}));_.states=p,_.name="preHandler",this.preHandler=_,u.add(_);const{width:y,height:x}=B(`${a}/${a}`,Object.assign({textAlign:"center",textBaseline:"middle"},l)),f=i.isNumber(b)?b:b[0],A=i.isNumber(b)?b:b[1],S=e.createText(Object.assign({x:h?f/2+g+y/2:0,y:h?0:A/2+g+x/2,text:`${r}/${a}`,textAlign:"center",textBaseline:"middle",lineHeight:null==l?void 0:l.fontSize},l));this.text=S,u.add(S);const E=e.createSymbol(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:h?f+2*g+y:0,y:h?0:A+2*g+x,symbolType:m,size:b}));E.name="nextHandler",E.states=p,this.nextHandler=E,u.add(E),1===this._total?(_.addState("disable"),E.addState("disable")):1===this._current?_.addState("disable"):this._current===a&&E.addState("disable");const L=u.AABBBounds,k=L.width(),M=L.height();u.translateTo(0-L.x1+d[3],0-L.y1+d[0]),this.add(u),this.attribute.width=k+d[1]+d[3],this.attribute.height=M+d[0]+d[2],this._bindEvents()}_bindEvents(){this.preHandler&&(this.preHandler.addEventListener("pointerenter",this._onHover),this.preHandler.addEventListener("pointerleave",this._onUnHover),this.preHandler.addEventListener("pointerdown",this._onClick)),this.nextHandler&&(this.nextHandler.addEventListener("pointerenter",this._onHover),this.nextHandler.addEventListener("pointerleave",this._onUnHover),this.nextHandler.addEventListener("pointerdown",this._onClick))}_reset(){this.removeAllChild(),this._current=1,this._total=this.attribute.total,this.preHandler=this.nextHandler=this.text=null}}ge.defaultAttributes={handler:be,textStyle:{fill:"rgb(51, 51, 51)",fontSize:12}};const pe=16,ve=8,me=12,_e=12;var ye,xe,fe;t.LegendStateValue=void 0,(ye=t.LegendStateValue||(t.LegendStateValue={})).selected="selected",ye.unSelected="unSelected",ye.selectedHover="selectedHover",ye.unSelectedHover="unSelectedHover",ye.focus="focus",t.LegendEvent=void 0,(xe=t.LegendEvent||(t.LegendEvent={})).legendItemHover="legendItemHover",xe.legendItemUnHover="legendItemUnHover",xe.legendItemClick="legendItemClick",xe.legendItemAttributeUpdate="legendItemAttributeUpdate",t.LEGEND_ELEMENT_NAME=void 0,(fe=t.LEGEND_ELEMENT_NAME||(t.LEGEND_ELEMENT_NAME={})).innerView="innerView",fe.title="legendTitle",fe.item="legendItem",fe.itemShape="legendItemShape",fe.itemLabel="legendItemLabel",fe.itemValue="legendItemValue",fe.focus="legendItemFocus";class Ae extends a{constructor(){super(...arguments),this.name="legend",this._title=null}render(){this.removeAllChild();const{interactive:s=!0,title:n,padding:a=0}=this.attribute,r=i.normalizePadding(a),l=e.createGroup({x:r[3],y:r[0],pickable:s,childrenPickable:s});l.name=t.LEGEND_ELEMENT_NAME.innerView,this.add(l),this._innerView=l,(null==n?void 0:n.visible)&&this._renderTitle(n),this._renderContent(),this._adjustLayout(),s&&this._bindEvents();const o=this._innerView.AABBBounds;this.attribute.width=o.width()+r[1]+r[3],this.attribute.height=o.height()+r[0]+r[2]}_renderTitle(e){const{text:s="",textStyle:n,padding:a=0,background:r,minWidth:l,maxWidth:o,shape:d}=e,h={x:0,y:0,text:s,textStyle:n,padding:i.normalizePadding(a),minWidth:l,maxWidth:o};d&&d.visible&&(h.shape=Object.assign({visible:!0},d.style),i.isValid(d.space)&&(h.space=d.space)),r&&r.visible&&(h.panel=Object.assign({visible:!0},r.style));const u=new w(h);u.name=t.LEGEND_ELEMENT_NAME.title,this._title=u,this._innerView.add(u)}_adjustLayout(){var t;if(this._title){const e=this._innerView.AABBBounds.width(),i=this._title.AABBBounds.width(),s=null===(t=this.attribute.title)||void 0===t?void 0:t.align;"center"===s?this._title.setAttribute("x",(e-i)/2):"end"===s&&this._title.setAttribute("x",e-i)}}}const Se={[t.LegendStateValue.focus]:{},[t.LegendStateValue.selected]:{},[t.LegendStateValue.selectedHover]:{},[t.LegendStateValue.unSelected]:{},[t.LegendStateValue.unSelectedHover]:{}};class Ee extends Ae{constructor(e){super(i.merge({},Ee.defaultAttributes,e)),this.name="discreteLegend",this._itemsContainer=null,this._itemHeightByUser=void 0,this._itemHeight=0,this._itemMaxWidth=0,this._onHover=e=>{var i;const s=e.target;if(null===(i=null==s?void 0:s.name)||void 0===i?void 0:i.startsWith(t.LEGEND_ELEMENT_NAME.item)){const i=s.delegate;i.hasState(t.LegendStateValue.selected)?this._setLegendItemState(i,t.LegendStateValue.selectedHover,e):this._setLegendItemState(i,t.LegendStateValue.unSelectedHover,e);const n=i.getChildren()[0].find((e=>e.name===t.LEGEND_ELEMENT_NAME.focus),!1);n&&n.setAttribute("visible",!0),this._dispatchEvent(t.LegendEvent.legendItemHover,i,e)}},this._onUnHover=e=>{var i;const s=e.target;if(null===(i=null==s?void 0:s.name)||void 0===i?void 0:i.startsWith(t.LEGEND_ELEMENT_NAME.item)){const i=s.delegate;let n=!1;(i.hasState(t.LegendStateValue.unSelectedHover)||i.hasState(t.LegendStateValue.selectedHover))&&(n=!0),i.removeState(t.LegendStateValue.unSelectedHover),i.removeState(t.LegendStateValue.selectedHover),i.getChildren()[0].getChildren().forEach((e=>{n||!e.hasState(t.LegendStateValue.unSelectedHover)&&!e.hasState(t.LegendStateValue.selectedHover)||(n=!0),e.removeState(t.LegendStateValue.unSelectedHover),e.removeState(t.LegendStateValue.selectedHover)}));const a=i.getChildren()[0].find((e=>e.name===t.LEGEND_ELEMENT_NAME.focus),!1);a&&a.setAttribute("visible",!1),n&&this._dispatchEvent(t.LegendEvent.legendItemAttributeUpdate,i,e),this._dispatchEvent(t.LegendEvent.legendItemUnHover,i,e)}},this._onClick=e=>{var i,s,n,a,r;const l=e.target;if(null===(i=null==l?void 0:l.name)||void 0===i?void 0:i.startsWith(t.LEGEND_ELEMENT_NAME.item)){const i=l.delegate;if(l.name===t.LEGEND_ELEMENT_NAME.focus){const a=i.hasState(t.LegendStateValue.focus);i.toggleState(t.LegendStateValue.focus),a?null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((i=>{this._removeLegendItemState(i,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover,t.LegendStateValue.focus],e),this._setLegendItemState(i,t.LegendStateValue.selected,e)})):(this._setLegendItemState(i,t.LegendStateValue.selected,e),this._removeLegendItemState(i,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover],e),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((s=>{i!==s&&(this._removeLegendItemState(s,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover,t.LegendStateValue.focus],e),this._setLegendItemState(s,t.LegendStateValue.unSelected,e))})))}else{null===(a=this._itemsContainer)||void 0===a||a.getChildren().forEach((e=>{e.removeState(t.LegendStateValue.focus)}));const{selectMode:s="multiple",allowAllCanceled:n=!0}=this.attribute,l=i.hasState(t.LegendStateValue.selected),o=this._getSelectedLegends();if("multiple"===s){if(!1===n&&l&&1===o.length)return void this._dispatchEvent(t.LegendEvent.legendItemClick,i,e);l?(this._removeLegendItemState(i,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover],e),this._setLegendItemState(i,t.LegendStateValue.unSelected,e)):(this._setLegendItemState(i,t.LegendStateValue.selected,e),this._removeLegendItemState(i,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover],e))}else this._setLegendItemState(i,t.LegendStateValue.selected,e),this._removeLegendItemState(i,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover],e),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((s=>{i!==s&&(this._removeLegendItemState(s,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover],e),this._setLegendItemState(s,t.LegendStateValue.unSelected,e))}))}this._dispatchEvent(t.LegendEvent.legendItemClick,i,e)}}}setSelected(e){var i;(null===(i=this._itemsContainer)||void 0===i?void 0:i.getChildren()).forEach((i=>{const s=i.data;e.includes(s.label)?(this._setLegendItemState(i,t.LegendStateValue.selected),this._removeLegendItemState(i,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover])):(this._removeLegendItemState(i,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover]),this._setLegendItemState(i,t.LegendStateValue.unSelected))}))}_renderContent(){const{item:t={},items:s,reversed:n,maxCol:a=1,maxRow:r=2}=this.attribute;if(!1===t.visible||i.isEmpty(s))return;let l=s;n&&(l=null==s?void 0:s.reverse());const o=e.createGroup({x:0,y:0});this._itemsContainer=o;const{layout:d,maxWidth:h,maxHeight:u,defaultSelected:c=[],autoPage:b}=this.attribute,g="horizontal"===d,{spaceCol:p=pe,spaceRow:v=ve,maxWidth:m,width:_,height:y}=t;i.isValid(m)?i.isValid(_)?this._itemWidthByUser=Math.min(m,_):this._itemWidthByUser=m:i.isValid(_)&&(this._itemWidthByUser=_),i.isValid(y)&&(this._itemHeightByUser=y);let x=!1,f=0,A=0,S=0,E=1,L=1;l.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const s=this._renderEachItem(t,!!i.isEmpty(c)||(null==c?void 0:c.includes(t.label)),e,l),n=s.attribute.width,d=s.attribute.height;this._itemHeight=Math.max(this._itemHeight,d),f=Math.max(n,f),this._itemMaxWidth=Math.max(n,this._itemMaxWidth),g?(E=r,i.isValid(h)&&(n>=h?(x=!0,e>0&&(A=0,S+=d+v,L+=1)):h<A+n&&(x=!0,A=0,S+=d+v,L+=1)),e>0&&s.setAttributes({x:A,y:S}),A+=p+n):(E=a,i.isValid(u)&&u<S+d&&(x=!0,S=0,A+=f+p,f=0,L+=1),e>0&&s.setAttributes({x:A,y:S}),S+=v+d),o.add(s)}));let k=!1;x&&b&&L>E&&(k=this._renderPager(g)),k||(o.setAttribute("y",this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",8):0),this._innerView.add(o))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(s,n,a,r){const{id:l,label:o,value:d,shape:h}=s,{padding:u=0,focus:c,focusIconStyle:b={}}=this.attribute.item;let{shape:g={},label:p={},value:v={},background:m={}}=this.attribute.item;g=this._handleStyle(g,s,n,a,r),p=this._handleStyle(p,s,n,a,r),v=this._handleStyle(v,s,n,a,r),m=this._handleStyle(m,s,n,a,r);const _=i.normalizePadding(u);let y;!1===m.visible?(y=e.createGroup({x:0,y:0,cursor:(null==m?void 0:m.style).cursor}),this._appendDataToShape(y,t.LEGEND_ELEMENT_NAME.item,s,y)):(y=e.createGroup(Object.assign({x:0,y:0},null==m?void 0:m.style)),this._appendDataToShape(y,t.LEGEND_ELEMENT_NAME.item,s,y,null==m?void 0:m.state)),y.addState(n?t.LegendStateValue.selected:t.LegendStateValue.unSelected);const x=e.createGroup({x:0,y:0,pickable:!1});y.add(x);let f=0;const A=i.get(g,"style.size",10),S=i.get(g,"space",8),E=e.createSymbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),g.style));let L;Object.keys(g.state||{}).forEach((t=>{const e=g.state[t].fill||g.state[t].stroke;h.fill&&i.isNil(g.state[t].fill)&&e&&(g.state[t].fill=e),h.stroke&&i.isNil(g.state[t].stroke)&&e&&(g.state[t].stroke=e)})),this._appendDataToShape(E,t.LEGEND_ELEMENT_NAME.itemShape,s,y,null==g?void 0:g.state),E.addState(n?t.LegendStateValue.selected:t.LegendStateValue.unSelected),x.add(E);let k=0;if(c){const n=i.get(b,"size",10);L=e.createSymbol(Object.assign(Object.assign({x:0,y:-n/2-1,strokeBoundsBuffer:0},b),{visible:!1,pickMode:"imprecise",boundsPadding:_})),this._appendDataToShape(L,t.LEGEND_ELEMENT_NAME.focus,s,y),k=n}const M=e.createText(Object.assign(Object.assign({x:A/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==p?void 0:p.style).fontSize},null==p?void 0:p.style),{text:p.formatMethod?p.formatMethod(o,s,a):o}));this._appendDataToShape(M,t.LEGEND_ELEMENT_NAME.itemLabel,s,y,null==p?void 0:p.state),M.addState(n?t.LegendStateValue.selected:t.LegendStateValue.unSelected),x.add(M);const B=i.get(p,"space",8);if(f+=A/2+S+M.AABBBounds.width()+B,i.isValid(d)){const r=i.get(v,"space",c?8:0),l=e.createText(Object.assign(Object.assign({x:f+B,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==v?void 0:v.style).fontSize},null==v?void 0:v.style),{text:v.formatMethod?v.formatMethod(d,s,a):d}));if(this._appendDataToShape(l,t.LEGEND_ELEMENT_NAME.itemValue,s,y,null==v?void 0:v.state),l.addState(n?t.LegendStateValue.selected:t.LegendStateValue.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-_[1]-_[3]-A-S-B-k-r,e=l.AABBBounds,i=M.AABBBounds,s=e.width(),n=i.width();n>t?(t-s)/n>.4?M.setAttribute("maxLineWidth",t-s):(l.setAttribute("maxLineWidth",.5*t),M.setAttribute("maxLineWidth",.5*t)):l.setAttribute("maxLineWidth",t-n),v.alignRight&&l.setAttributes({textAlign:"right",x:this._itemWidthByUser-A/2-_[1]-_[3]-k-r})}f=l.AABBBounds.x2+r,x.add(l)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-_[1]-_[3]-A-S-k);L&&(L.setAttribute("x",f),x.add(L));const w=x.AABBBounds,T=w.width(),C=w.height(),P=i.isValid(this.attribute.item.width)?this.attribute.item.width:T+_[1]+_[3],O=this._itemHeightByUser||C+_[0]+_[2];return y.attribute.width=P,y.attribute.height=O,x.translateTo(-w.x1+_[3],-w.y1+_[0]),y}_renderPager(t){const s=this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",8):0,{maxWidth:n,maxHeight:a,maxCol:r=1,maxRow:l=2,item:d={},pager:h={}}=this.attribute,{spaceCol:u=pe,spaceRow:c=ve}=d,b=this._itemsContainer,{animation:g=!0,animationDuration:p=450,animationEasing:v="quadIn",space:m=_e}=h,_=o(h,["animation","animationDuration","animationEasing","space"]);let y,x=0,f=0,A=0,S=0,E=1;if(t){if(y=new ge(Object.assign({layout:1===l?"horizontal":"vertical",total:99},i.merge({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},_))),this._pager=y,this._innerView.add(y),x=(l-1)*c+this._itemHeight*l,f=n-y.AABBBounds.width()-m,f<=0)return this._innerView.removeChild(y),!1;b.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;f<A+i&&(A=0,S+=s+c,E+=1),e>0&&t.setAttributes({x:A,y:S}),A+=u+i})),y.setAttributes({total:Math.ceil(E/l),x:f,y:s+x/2-y.AABBBounds.height()/2})}else{if(y=new ge(Object.assign({layout:"horizontal",total:99},_)),this._pager=y,this._innerView.add(y),f=this._itemMaxWidth*r+(r-1)*u,x=a-y.AABBBounds.height()-m-s,x<=0)return this._innerView.removeChild(y),!1;b.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;x<S+i&&(S=0,A+=this._itemMaxWidth+u,E+=1),e>0&&t.setAttributes({x:A,y:S}),S+=c+i})),y.setAttributes({total:Math.ceil(E/r),x:(f-y.AABBBounds.width())/2,y:a-y.AABBBounds.height()})}h.defaultCurrent>1&&(t?b.setAttribute("y",-(h.defaultCurrent-1)*(x+c)):b.setAttribute("x",-(h.defaultCurrent-1)*(f+u)));const L=e.createGroup({x:0,y:s,width:f,height:x,clip:!0,pickable:!1});L.add(b),this._innerView.add(L);const k=e=>{const{current:i}=e.detail;g?b.animate().to(t?{y:-(i-1)*(x+c)}:{x:-(i-1)*(f+u)},p,v):t?b.setAttribute("y",-(i-1)*(x+c)):b.setAttribute("x",-(i-1)*(f+u))};return this._pager.addEventListener("toPrev",k),this._pager.addEventListener("toNext",k),!0}_setLegendItemState(e,i,s){let n=!1;e.hasState(i)||(n=!0),e.addState(i,true),e.getChildren()[0].getChildren().forEach((e=>{e.name!==t.LEGEND_ELEMENT_NAME.focus&&(n||e.hasState(i)||(n=!0),e.addState(i,true))})),n&&this._dispatchEvent(t.LegendEvent.legendItemAttributeUpdate,e,s)}_removeLegendItemState(e,i,s){let n=!1;i.forEach((t=>{!n&&e.hasState(t)&&(n=!0),e.removeState(t)})),e.getChildren()[0].getChildren().forEach((e=>{e.name!==t.LEGEND_ELEMENT_NAME.focus&&i.forEach((t=>{!n&&e.hasState(t)&&(n=!0),e.removeState(t)}))})),n&&this._dispatchEvent(t.LegendEvent.legendItemAttributeUpdate,e,s)}_getSelectedLegends(){var e;const i=[];return null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{e.hasState(t.LegendStateValue.selected)&&i.push(e.data)})),i}_appendDataToShape(t,e,s,n,a={}){t.name=e,t.data=s,t.delegate=n,t.states=i.merge({},Se,a)}_dispatchEvent(i,s,n){var a;const r=this._getSelectedLegends();r.sort(((t,e)=>t.index-e.index));const l=r.map((t=>t.label)),o=new e.CustomEvent(i,{item:s,data:s.data,selected:s.hasState(t.LegendStateValue.selected),currentSelectedItems:r,currentSelected:l,event:n});o.manager=null===(a=this.stage)||void 0===a?void 0:a.eventSystem.manager,this.dispatchEvent(o)}_handleStyle(t,e,s,n,a){const r=i.merge({},t);return t.style&&i.isFunction(t.style)&&(r.style=t.style(e,s,n,a)),t.state&&Object.keys(t.state).forEach((l=>{t.state[l]&&i.isFunction(t.state[l])&&(r.state[l]=t.state[l](e,s,n,a))})),r}}var Le;function ke(t){return i.isArray(t)?t:[t,t]}function Me(t){return t?"ew-resize":"ns-resize"}Ee.defaultAttributes={layout:"horizontal",title:{align:"start",space:me,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:pe,spaceRow:ve,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:_e,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},t.SLIDER_ELEMENT_NAME=void 0,(Le=t.SLIDER_ELEMENT_NAME||(t.SLIDER_ELEMENT_NAME={})).innerView="innerView",Le.railContainer="sliderRailContainer",Le.rail="sliderRail",Le.startText="sliderStartText",Le.endText="sliderEndText",Le.startHandler="sliderStartHandler",Le.startHandlerText="startHandlerText",Le.endHandler="sliderEndHandler",Le.endHandlerText="sliderEndHandlerText",Le.track="sliderTrack",Le.trackContainer="sliderTrackContainer";class Be extends a{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(t){super(i.merge({},Be.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===e.vglobal.env?(e.vglobal.addEventListener("pointermove",this._onHandlerPointerMove),e.vglobal.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,s;t.stopPropagation();const{railWidth:n,railHeight:a,min:r,max:l}=this.attribute;if(l===r)return;let o,d,h,u=0;this._isHorizontal?(o=t.clientX,u=o-this._prePos,d=null===(s=this._currentHandler)||void 0===s?void 0:s.attribute.x,h=n):(o=t.clientY,u=o-this._prePos,d=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=a);const c=i.clamp(d+u,0,h),b=c/h*(l-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,c,b):this._updateHandler(this._currentHandler,c,b),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===e.vglobal.env)e.vglobal.removeEventListener("pointermove",this._onHandlerPointerMove),e.vglobal.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===e.vglobal.env?(e.vglobal.addEventListener("pointermove",this._onTrackPointerMove),e.vglobal.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:s,min:n,max:a}=this.attribute;if(a===n)return;const{startHandler:r,endHandler:l}=this._getHandlers();let o,d,h;this._isHorizontal?(o=t.clientX,d=this._track.attribute.width,h=e):(o=t.clientY,d=this._track.attribute.height,h=s);const u=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=i.clamp(t+u,0,h-d),s=e/h*(a-n)+n;this._updateHandler(r,e,s)}if(l){const t=this._isHorizontal?l.attribute.x:l.attribute.y,e=i.clamp(t+u,d,h),s=e/h*(a-n)+n;this._updateHandler(l,e,s),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==l?void 0:l.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==l?void 0:l.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==l?void 0:l.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==l?void 0:l.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===e.vglobal.env?(e.vglobal.removeEventListener("pointermove",this._onTrackPointerMove),e.vglobal.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:s,min:n,max:a}=this.attribute;if(a===n)return;const r=this._startHandler,l=this._endHandler;let o,d,h,u;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,d=null==r?void 0:r.attribute.x,h=null==l?void 0:l.attribute.x,u=e):(o=t.viewY-this._rail.globalAABBBounds.y1,d=null==r?void 0:r.attribute.y,h=null==l?void 0:l.attribute.y,u=s);const c=o/u*(a-n)+n;if(i.isValid(h)){const t=Math.abs(o-d)>Math.abs(o-h)?l:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const{layout:e,railWidth:s,railHeight:n,min:a,max:r}=this.attribute;if(r===a)return;const[l,o]=i.array(t),{startHandler:d,endHandler:h}=this._getHandlers(),u="vertical"===e?n:s,c=(l-a)/(r-a)*u;if(d&&this._updateHandler(d,c,l),h){const t=(o-a)/(r-a)*u;this._updateHandler(h,t,o)}this._updateTrack()}render(){var s,n;this.removeAllChild();const{layout:a="horizontal",railWidth:r,railHeight:l,startText:o,endText:d,min:h,max:u,showHandler:c=!0}=this.attribute;let{value:b}=this.attribute;i.isNil(b)&&(b=[h,u]),this._currentValue={startValue:ke(b)[0],endValue:ke(b)[1]};const g="horizontal"===a;this._isHorizontal=g;const p=e.createGroup({x:0,y:0});p.name=t.SLIDER_ELEMENT_NAME.innerView,this.add(p),this._innerView=p;let v,m=0;if(o&&o.visible){v=e.createText(Object.assign({x:g?0:r/2,y:g?l/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:o.text,lineHeight:null===(s=o.style)||void 0===s?void 0:s.fontSize},o.style)),v.name=t.SLIDER_ELEMENT_NAME.startText,p.add(v);const n=i.isValid(o.space)?o.space:0;m+=(g?v.AABBBounds.width():v.AABBBounds.height())+n}const _=e.createGroup({x:g?m:0,y:g?0:m});p.add(_);const y=e.createGroup({x:0,y:0});let x;if(y.name=t.SLIDER_ELEMENT_NAME.railContainer,this._railContainer=y,_.add(y),this._renderRail(y),m+=g?r:l,d&&d.visible){const s=i.isValid(d.space)?d.space:0;x=e.createText(Object.assign({x:g?m+s:r/2,y:g?l/2:m+s,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:d.text,lineHeight:null===(n=d.style)||void 0===n?void 0:n.fontSize},d.style)),x.name=t.SLIDER_ELEMENT_NAME.endText,p.add(x)}this._renderTrack(y),c&&(this._renderHandlers(_),this._bindEvents())}_renderRail(i){const{railWidth:s,railHeight:n,railStyle:a,slidable:r}=this.attribute;let l="default";!1!==r&&(l="pointer");const o=e.createRect(Object.assign({x:0,y:0,width:s,height:n,cursor:l},a));return o.name=t.SLIDER_ELEMENT_NAME.rail,i.add(o),this._rail=o,o}_renderHandlers(e){const{range:s,min:n,max:a,handlerSize:r=14,handlerStyle:l,handlerText:o,railHeight:d,railWidth:h,slidable:u}=this.attribute;let{value:c}=this.attribute;i.isNil(c)&&(c=[n,a]);const b=o&&o.visible,g=this._isHorizontal,p=g?h:d,[v,m]=ke(c),_=a===n?s?0:p:(v-n)/(a-n)*p,y=this._renderHandler(Object.assign({x:g?_:h/2,y:g?d/2:_,size:r,strokeBoundsBuffer:0,cursor:!1===u?"default":Me(g)},l));if(y.name=t.SLIDER_ELEMENT_NAME.startHandler,this._startHandler=y,e.add(y),this._currentValue.startPos=_,b){const i=this._renderHandlerText(v,s?"start":"end");i.name=t.SLIDER_ELEMENT_NAME.startHandlerText,e.add(i),this._startHandlerText=i}if(s){const i=a===n?p:(m-n)/(a-n)*p,s=this._renderHandler(Object.assign({x:g?i:h/2,y:g?d/2:i,size:r,strokeBoundsBuffer:0,cursor:!1===u?"default":Me(g)},l));if(s.name=t.SLIDER_ELEMENT_NAME.endHandler,this._endHandler=s,e.add(s),this._currentValue.endPos=i,b){const i=this._renderHandlerText(m,"end");i.name=t.SLIDER_ELEMENT_NAME.endHandlerText,e.add(i),this._endHandlerText=i}}}_renderTrack(s){const{range:n,min:a,max:r,railHeight:l,railWidth:o,trackStyle:d,railStyle:h,slidable:u,value:c}=this.attribute;let b,g;if(i.isNil(c))n?(b=a,g=r):b=g=a;else if(n){const t=i.clampRange(c,a,r);b=t[0],g=t[1]}else b=a,g=i.clamp(c,a,r);const p=this._isHorizontal,v=p?o:l;n||(b=a);const m=e.createGroup({x:0,y:0,width:o,height:l,cornerRadius:null==h?void 0:h.cornerRadius,clip:!0,pickable:!1});m.name=t.SLIDER_ELEMENT_NAME.trackContainer;const _=i.isObject(n)&&!0===n.draggableTrack;let y;y=!1===u?"default":!1===n||!1===_?"pointer":Me(p);const x=r===a?v:(g-b)/(r-a)*v,f=r===a?0:(b-a)/(r-a)*v,A=e.createRect(Object.assign({x:p?f:0,y:p?0:f,width:p?x:o,height:p?l:x,cursor:y},d));A.name=t.SLIDER_ELEMENT_NAME.track,this._track=A,m.add(A),s.add(m)}_renderHandler(t){return e.createSymbol(t)}_renderHandlerText(t,i){var s,n,a;const{align:r,min:l,max:o,handlerSize:d=14,handlerText:h={},railHeight:u,railWidth:c,slidable:b}=this.attribute,g=this._isHorizontal,p=g?c:u,v=o===l?"start"===i?0:p:(t-l)/(o-l)*p,m=null!==(s=h.space)&&void 0!==s?s:4,_=Object.assign({text:(null==h?void 0:h.formatter)?h.formatter(t):t.toFixed(null!==(n=null==h?void 0:h.precision)&&void 0!==n?n:0),lineHeight:null===(a=h.style)||void 0===a?void 0:a.lineHeight,cursor:!1===b?"default":Me(g)},h.style);g?"top"===r?(_.textBaseline="bottom",_.textAlign="center",_.x=v,_.y=(u-d)/2-m):(_.textBaseline="top",_.textAlign="center",_.x=v,_.y=(u+d)/2+m):"left"===r?(_.textBaseline="middle",_.textAlign="end",_.x=(c-d)/2-m,_.y=v):(_.textBaseline="middle",_.textAlign="start",_.x=(c+d)/2+m,_.y=v);return e.createText(_)}_bindEvents(){const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),i.isObject(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(e,i,s){var n;const a=this._isHorizontal;e.setAttribute(a?"x":"y",i);const r=e.name===t.SLIDER_ELEMENT_NAME.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(s):s.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[a?"x":"y"]:i})}e.name===t.SLIDER_ELEMENT_NAME.startHandler?(this._currentValue.startValue=s,this._currentValue.startPos=i):(this._currentValue.endValue=s,this._currentValue.endPos=i)}_updateHandlerText(e,i,s){var n;const a=this._isHorizontal,{handlerText:r}=this.attribute;e.setAttributes({[a?"x":"y"]:i,text:(null==r?void 0:r.formatter)?r.formatter(s):s.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const l=e.name===t.SLIDER_ELEMENT_NAME.startHandlerText?this._startHandler:this._endHandler;l&&(null==l||l.setAttributes({[a?"x":"y"]:i})),e.name===t.SLIDER_ELEMENT_NAME.startHandlerText?(this._currentValue.startValue=s,this._currentValue.startPos=i):(this._currentValue.endValue=s,this._currentValue.endPos=i)}_dispatchChangeEvent(){var t;const i=!!this.attribute.range,s=this._currentValue,n=new e.CustomEvent("change",{value:i?[Math.min(s.endValue,s.startValue),Math.max(s.endValue,s.startValue)]:s.startValue,position:i?[Math.min(s.endPos,s.startPos),Math.max(s.endPos,s.startPos)]:s.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}}Be.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class we extends Ae{constructor(t){super(i.merge({},we.defaultAttributes,t)),this.name="colorLegend",this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:n,align:a,min:r,max:l,value:o,railWidth:d,railHeight:h,showHandler:u=!0,handlerSize:c,handlerStyle:b,railStyle:g,trackStyle:p,startText:v,endText:m,handlerText:_,showTooltip:y,tooltip:x}=this.attribute,f=[],A=(l-r)/(t.length-1);for(let e=0;e<t.length;e++)f.push(r+A*e);this._colorScale=(new s.LinearScale).domain(f,!0).range(t),this._color=this._getTrackColor();const S=new Be({x:0,y:0,range:{draggableTrack:!0},slidable:e,layout:n,align:a,min:r,max:l,value:o,railWidth:d,railHeight:h,showHandler:u,handlerSize:c,handlerStyle:b,railStyle:g,trackStyle:Object.assign({fill:this._color},p),startText:v,endText:m,handlerText:_,showTooltip:y,tooltip:x});this._innerView.add(S),this._slider=S,S.translateTo(0-S.AABBBounds.x1,(this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",me):0)-S.AABBBounds.y1),this._updateColor()}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}_getTrackColor(){const{colors:t,layout:e}=this.attribute;if(i.isEmpty(t))return;const s=t.length;if(1===s)return t[0];const n=[];for(let e=0;e<s;e++){const i=e/(s-1);n.push({offset:i,color:t[e]})}const a="horizontal"===e;return{gradient:"linear",stops:n,x0:0,y0:0,x1:a?1:0,y1:a?0:1}}_updateColor(){const{layout:t="horizontal",colors:e,railWidth:i,railHeight:s}=this.attribute,{startHandler:n,endHandler:a,track:r}=this._slider,{startValue:l,endValue:o,startPos:d,endPos:h}=this._slider.currentValue,u=this._colorScale.scale(l),c=this._colorScale.scale(o);null==n||n.setAttribute("fill",u),null==a||a.setAttribute("fill",c);const b="horizontal"===t?i:s;if(Math.abs(d-h)!==b&&e&&e.length>1){const t=this._color.stops,e=Math.min(d,h),i=Math.max(d,h),s=e/b,n=i/b,a=n-s,u=t.filter((t=>t.offset>s&&t.offset<n)),c=Math.min(l,o),g=Math.max(l,o),p=this._colorScale.scale(c),v=this._colorScale.scale(g),m=[{offset:0,color:p}];u.forEach((t=>{m.push({offset:(t.offset-s)/a,color:t.color})})),m.push({offset:1,color:v}),r.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:m}))}}}function Te(t="bottom"){let e=0;const i=3.5,s=2.5;return"top"===t?`\n M${e},-6L${e-i},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+s},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-s},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-i},2.5\n v-5\n h7\n v5\n Z\n`}we.defaultAttributes={layout:"horizontal",title:{align:"start",space:me,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class Ce extends Ae{constructor(t){super(i.merge({},Ce.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:s,align:n,min:a,max:r,value:l,railWidth:o,railHeight:d,showHandler:h=!0,handlerSize:u,handlerStyle:c,railStyle:b,trackStyle:g,startText:p,endText:v,handlerText:m,showTooltip:_,tooltip:y,sizeBackground:x}=this.attribute,f=e.createGroup({x:0,y:0});this._innerView.add(f);const A=new Be({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:s,align:n,min:a,max:r,value:l,railWidth:o,railHeight:d,showHandler:h,handlerSize:u,handlerStyle:Object.assign({symbolType:Te(n)},c),railStyle:b,trackStyle:g,startText:p,endText:v,handlerText:m,showTooltip:_,tooltip:y});f.add(A);let S,E=0;const L=12;"horizontal"===s?"top"===n?(S=`M0,0L${o},0L${o},12Z`,E=d):(S=`M0,12L${o},12L${o},0Z`,A.setAttribute("y",L)):"left"===n?S=`M${o},0L${o},0L${o+L},${d}L${o},${d}Z`:(S=`M0,${d}L12,${d}L12,0Z`,A.setAttribute("x",L));const k=e.createPath(Object.assign(Object.assign({x:0,y:E,path:S},x),{zIndex:0}));f.add(k);const M=this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",me):0;f.translate(0-f.AABBBounds.x1,M-f.AABBBounds.y1),this._slider=A}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}Ce.defaultAttributes={layout:"horizontal",title:{align:"start",space:me,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}};class Pe extends a{constructor(t){super(i.merge({},Pe.defaultAttributes,t)),this.name="title"}render(){var t,e,s,n,a,r,l,o,d,h,u,c,b,g,p,v,m,_,y,x,f,A,S,E,L,k,M,B,w,T,C,P,O,I,H,V,z,j,R,N,D,$,W,U,F,G,Y,X,q,Z,J,K,Q,tt,et,it,st,nt,at,rt,lt,ot;const{text:dt,textStyle:ht,subtext:ut,subtextStyle:ct,width:bt,height:gt,minWidth:pt,maxWidth:vt,minHeight:mt,maxHeight:_t,align:yt,verticalAlign:xt,padding:ft=0}=this.attribute,At=i.normalizePadding(ft),St=this.createOrUpdateChild("title-container",{x:At[3],y:At[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ht?void 0:ht.visible))if(ht&&i.isValid(null==ht?void 0:ht.character)){const t={x:null!==(e=ht.x)&&void 0!==e?e:0,y:null!==(s=ht.y)&&void 0!==s?s:0,width:null!==(a=null!==(n=ht.width)&&void 0!==n?n:bt)&&void 0!==a?a:0,height:null!==(l=null!==(r=ht.height)&&void 0!==r?r:gt)&&void 0!==l?l:0,ellipsis:null===(o=ht.ellipsis)||void 0===o||o,wordBreak:null!==(d=ht.wordBreak)&&void 0!==d?d:"break-word",maxHeight:ht.maxHeight,maxWidth:ht.maxWidth,textConfig:ht.character};this._mainTitle=St.createOrUpdateChild("mainTitle",t,"richtext")}else i.isValid(dt)&&(this._mainTitle=St.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[dt]},ht),{maxLineWidth:null!==(h=null==ht?void 0:ht.maxLineWidth)&&void 0!==h?h:bt,heightLimit:null==ht?void 0:ht.heightLimit,lineClamp:null==ht?void 0:ht.lineClamp,ellipsis:null===(u=null==ht?void 0:ht.ellipsis)||void 0===u||u,x:0,y:0}),"wrapText"));const Et=this._mainTitle?null===(c=this._mainTitle)||void 0===c?void 0:c.AABBBounds.height():0,Lt=this._mainTitle?null===(b=this._mainTitle)||void 0===b?void 0:b.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&i.isValid(null==ct?void 0:ct.character)){const t={x:null!==(p=ct.x)&&void 0!==p?p:0,y:null!==(v=ct.y)&&void 0!==v?v:Et,width:null!==(_=null!==(m=ct.width)&&void 0!==m?m:bt)&&void 0!==_?_:0,height:null!==(x=null!==(y=ct.height)&&void 0!==y?y:gt)&&void 0!==x?x:0,ellipsis:null===(f=ct.ellipsis)||void 0===f||f,wordBreak:null!==(A=ct.wordBreak)&&void 0!==A?A:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._subTitle=St.createOrUpdateChild("subTitle",t,"richtext")}else i.isValid(ut)&&(this._subTitle=St.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[ut]},ct),{maxLineWidth:null!==(S=null==ct?void 0:ct.maxLineWidth)&&void 0!==S?S:bt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(E=null==ct?void 0:ct.ellipsis)||void 0===E||E,x:0,y:Et}),"wrapText"));const kt=this._subTitle?null===(L=this._subTitle)||void 0===L?void 0:L.AABBBounds.height():0,Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.width():0;let Bt=Math.max(Lt,Mt),wt=Et+(null!==(M=null==ct?void 0:ct.height)&&void 0!==M?M:kt);if(i.isValid(bt)&&(Bt=bt,null===(B=this._mainTitle)||void 0===B||B.setAttribute("maxLineWidth",bt),null===(w=this._subTitle)||void 0===w||w.setAttribute("maxLineWidth",bt)),i.isValid(gt)&&(wt=gt),i.isValid(pt)&&Bt<pt&&(Bt=pt),i.isValid(vt)&&(null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",vt),null===(C=this._subTitle)||void 0===C||C.setAttribute("maxLineWidth",vt),null===(P=this._mainTitle)||void 0===P||P.setAttribute("maxWidth",vt),null===(O=this._subTitle)||void 0===O||O.setAttribute("maxWidth",vt),Bt>vt&&(Bt=vt)),i.isValid(mt)&&wt<mt&&(wt=mt),i.isValid(_t)&&(null===(I=this._mainTitle)||void 0===I||I.setAttribute("maxHeight",_t),null===(H=this._subTitle)||void 0===H||H.setAttribute("maxHeight",_t-Et),wt>_t&&(wt=_t)),St.attribute.width=Bt+At[1]+At[3],St.attribute.height=wt+At[0]+At[2],i.isValid(yt)||i.isValid(null==ht?void 0:ht.align)){const t=(null==ht?void 0:ht.align)?null==ht?void 0:ht.align:yt,e=null!==(V=null==ht?void 0:ht.width)&&void 0!==V?V:Lt;"left"===t?(null===(z=this._mainTitle)||void 0===z||z.setAttribute("x",0),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","left")):"center"===t?(null===(R=this._mainTitle)||void 0===R||R.setAttribute("x",e/2),null===(N=this._mainTitle)||void 0===N||N.setAttribute("textAlign","center")):"right"===t&&(null===(D=this._mainTitle)||void 0===D||D.setAttribute("x",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textAlign","right"))}if(i.isValid(xt)||i.isValid(null==ht?void 0:ht.verticalAlign)){const t=(null==ht?void 0:ht.verticalAlign)?null==ht?void 0:ht.verticalAlign:xt,e=(null==ht?void 0:ht.height)?null==ht?void 0:ht.height:Bt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(U=this._mainTitle)||void 0===U||U.setAttribute("textBaseline","top")):"middle"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("y",e/2),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("y",e),null===(X=this._mainTitle)||void 0===X||X.setAttribute("textBaseline","bottom"))}if(i.isValid(yt)||i.isValid(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:yt,e=null!==(q=null==ct?void 0:ct.width)&&void 0!==q?q:Mt;"left"===t?(null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("x",0),null===(J=this._subTitle)||void 0===J||J.setAttribute("textAlign","left")):"center"===t?(null===(K=this._subTitle)||void 0===K||K.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(i.isValid(xt)||i.isValid(null==ht?void 0:ht.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:xt,e=Et,i=null!==(it=null==ct?void 0:ct.height)&&void 0!==it?it:0;"top"===t?(null===(st=this._subTitle)||void 0===st||st.setAttribute("y",e),null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("textBaseline","top")):"middle"===t?(null===(at=this._subTitle)||void 0===at||at.setAttribute("y",e+i/2),null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("y",e+i),null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("textBaseline","bottom"))}}}Pe.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const Oe={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};const Ie=(t,e)=>{let i=t.x0,s=t.x1;const n="number"==typeof e?t.thickness*e:t.thickness;let a=t.y0-t.thickness/2,r=t.y1-t.thickness/2;"center"===t.align?(a=t.y0-n/2,r=t.y1-n/2):"end"===t.align&&(a=t.y0+t.thickness/2-n,r=t.y1+t.thickness/2-n);let l=(i+s)/2,o=a+n,d=r+n;t.round&&(i=Math.round(i),s=Math.round(s),a=Math.round(a),r=Math.round(r),o=Math.round(o),d=Math.round(d),l=Math.round(l));const h=Math.abs(s-i)>1e-6,u=t.endArrow&&h?`L${s},${r-n/2}L${s+n},${(r+d)/2}L${s},${d+n/2}`:"",c=t.startArrow&&h?`L${i},${o+n/2}L${i-n},${(a+o)/2}L${i},${a-n/2}`:"";return!1===t.isSmooth?`M${i},${a}L${s},${r}${u}L${s},${d}L${i},${o}${c}Z`:`M${i},${a}\n C${l},${a},${l},${r},${s},${r}\n ${u}\n L${s},${d}\n C${l},${d},${l},${o},${i},${o}\n ${c}\n Z`},He=(t,e)=>{let i=t.y0,s=t.y1,n=t.x0-t.thickness/2,a=t.x1-t.thickness/2;const r="number"==typeof e?t.thickness*e:t.thickness;"center"===t.align?(n=t.x0-r/2,a=t.x1-r/2):"end"===t.align&&(n=t.x0+t.thickness/2-r,a=t.x1+t.thickness/2-r);let l=(i+s)/2,o=n+r,d=a+r;t.round&&(i=Math.round(i),s=Math.round(s),n=Math.round(n),a=Math.round(a),o=Math.round(o),d=Math.round(d),l=Math.round(l));const h=Math.abs(s-i)>1e-6,u=t.endArrow&&h?`L${a-r/2},${s}L${(a+d)/2},${s+r}L${d+r/2},${s}`:"",c=t.startArrow&&h?`L${o+r/2},${i}L${(o+n)/2},${i-r}L${n-r/2},${i}`:"";return!1===t.isSmooth?`M${n},${i}L${a},${s}${u}L${d},${s}L${o},${i}${c}Z`:`M${n},${i}\n C${n},${l},${a},${l},${a},${s}\n ${u}\n L${d},${s}\n C${d},${l},${o},${l},${o},${i}\n ${c}\n Z`};class Ve extends a{constructor(t){super(i.merge({},Ve.defaultAttributes,t))}render(){const{direction:t="horizontal"}=this.attribute,e="vertical"===t?He:Ie,i="number"==typeof this.attribute.ratio&&this.attribute.ratio>=0&&this.attribute.ratio<=1,s=["direction","x0","x1","y0","y1","thickness","round","ratio","align","isSmooth","backgroudStyle"],n={};if(Object.keys(this.attribute).forEach((t=>{s.includes(t)||(n[t]=this.attribute[t])})),i){const t=this.createOrUpdateChild("sankey-link-background",Object.assign({},n,this.attribute.backgroudStyle,{path:e(this.attribute,1),visible:!0,pickable:!1,zIndex:-1}),"path");this._backPath=t}else this._backPath&&this._backPath.setAttribute("visible",!1);const a=this.createOrUpdateChild("sankey-link-front",Object.assign({},n,{path:e(this.attribute,i?this.attribute.ratio:1),pickable:!1}),"path");this._frontPath=a}}Ve.defaultAttributes={direction:"horizontal",align:"start"};class ze extends e.Symbol{constructor(t){super(t)}}var je,Re;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(je||(je={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(Re||(Re={}));class Ne extends a{constructor(t){super(i.merge({},Ne.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},Ne.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},Ne.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},Ne.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},Ne.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s,n,a,r,l;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(s=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==s?s:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(a=null===(n=this._backwardAttr.style)||void 0===n?void 0:n.symbolType)&&void 0!==a?a:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(l=null===(r=this._forwardAttr.style)||void 0===r?void 0:r.symbolType)&&void 0!==l?l:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{i.isNil(this._playController)&&(this._playController=new ze(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{i.isNil(this._backwardController)&&(this._backwardController=new ze(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{i.isNil(this._forwardController)&&(this._forwardController=new ze(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()}))},this._createCustomEvent=t=>{var i;const s=new e.CustomEvent(t,{eventType:t});return s.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,s},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{const t=this._createCustomEvent(je.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(je.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(je.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(je.OnBackward);this.dispatchEvent(t)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}Ne.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},Ne.defaultAttributes={[Re.Start]:{},[Re.Pause]:{},[Re.Backward]:{},[Re.Forward]:{}};const De={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},$e=[200,10];var We,Ue;t.DirectionEnum=void 0,(We=t.DirectionEnum||(t.DirectionEnum={})).Default="default",We.Reverse="reverse",t.PlayerEventEnum=void 0,(Ue=t.PlayerEventEnum||(t.PlayerEventEnum={})).change="change",Ue.play="play",Ue.pause="pause",Ue.backward="backward",Ue.forward="forward",Ue.end="end",Ue.OnChange="change",Ue.OnPlay="play",Ue.OnPause="pause",Ue.OnBackward="backward",Ue.OnForward="forward",Ue.OnEnd="end";const Fe=({direction:e,maxIndex:i,minIndex:s,dataIndex:n})=>(({direction:e,maxIndex:i,dataIndex:s})=>e===t.DirectionEnum.Default&&s===i)({direction:e,maxIndex:i,dataIndex:n})||(({direction:e,minIndex:i,dataIndex:s})=>e===t.DirectionEnum.Reverse&&s===i)({direction:e,minIndex:s,dataIndex:n}),Ge=({direction:e,maxIndex:i,minIndex:s,dataIndex:n})=>(({direction:e,minIndex:i,dataIndex:s})=>e===t.DirectionEnum.Default&&s===i)({direction:e,minIndex:s,dataIndex:n})||(({direction:e,maxIndex:i,dataIndex:s})=>e===t.DirectionEnum.Reverse&&s===i)({direction:e,maxIndex:i,dataIndex:n}),Ye=t=>"top"===t||"bottom"===t;class Xe extends a{constructor(t){super(i.merge({},Xe.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,s;let n;i.isValidNumber(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=i.max(this._handlerStyle.size[0],this._handlerStyle.size[1]));const a={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:i.isValidNumber(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(Ye(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:$e[1];a.layout="horizontal",a.railHeight=i,a.railWidth=t,a.x=this._layoutInfo.slider.x,a.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(s=this._railStyle.width)&&void 0!==s?s:$e[1];a.layout="vertical",a.railWidth=e,a.railHeight=t,a.x=this._layoutInfo.slider.x,a.y=this._layoutInfo.slider.y}return a},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new Be(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return Ye(this._orient)?(t.layout="horizontal",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(t.layout="vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new Ne(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,s,n,a,r,l,o,d,h,u,c,b,g,p,v,m;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._sliderVisible=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.visible,this._railStyle=Object.assign({},null===(s=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===s?void 0:s.railStyle),this._trackStyle=Object.assign({},null===(a=null===(n=this.attribute)||void 0===n?void 0:n.slider)||void 0===a?void 0:a.trackStyle),this._handlerStyle=Object.assign({},null===(l=null===(r=this.attribute)||void 0===r?void 0:r.slider)||void 0===l?void 0:l.handlerStyle),this._controllerVisible=null===(d=null===(o=this.attribute)||void 0===o?void 0:o.controller)||void 0===d?void 0:d.visible,this._start=Object.assign({},null===(u=null===(h=this.attribute)||void 0===h?void 0:h.controller)||void 0===u?void 0:u.start),this._pause=Object.assign({},null===(b=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===b?void 0:b.pause),this._forward=Object.assign({},null===(p=null===(g=this.attribute)||void 0===g?void 0:g.controller)||void 0===p?void 0:p.forward),this._backward=Object.assign({},null===(m=null===(v=this.attribute)||void 0===v?void 0:v.controller)||void 0===m?void 0:m.backward)}_initLayoutInfo(){var t,e,s;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),a=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),l=null!==(t=Ye(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:$e[1],o=n.reduce(((t,e)=>{const s=e.style.size,n=i.isNumber(s)?s:i.max(s[0],s[1]);return t+e.space+n}),0),d=this._sliderVisible?(Ye(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(s=this._size)||void 0===s?void 0:s.height)-o:0,h=d-this.attribute.slider.space,u=a.reduce(((t,e)=>{const{key:s,space:n,style:{size:a}}=e,r=i.isNumber(a)?a:i.max(a[0],a[1]);return this._layoutInfo[s]=Object.assign(Object.assign({},this._layoutInfo[s]),{size:r,x:Ye(this._orient)?t+n:(this._size.width-r)/2,y:Ye(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:Ye(this._orient)?u+this.attribute.slider.space:(this._size.width-l)/2,y:Ye(this._orient)?(this._size.height-l)/2:u+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:s,space:n,style:{size:a}}=e,r=i.isNumber(a)?a:i.max(a[0],a[1]);return this._layoutInfo[s]=Object.assign(Object.assign({},this._layoutInfo[s]),{size:r,x:Ye(this._orient)?t+n:(this._size.width-r)/2,y:Ye(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),u+d)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,i){var s;const n=new e.CustomEvent(t,{eventType:t,index:i,value:this._data[i]});n.manager=null===(s=this.stage)||void 0===s?void 0:s.eventSystem.manager,this.dispatchEvent(n)}}Xe.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},De),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},De),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},De),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},De),{key:"backward",position:"start"})}};var qe;t.IOperateType=void 0,(qe=t.IOperateType||(t.IOperateType={})).drawStart="drawStart",qe.drawEnd="drawEnd",qe.drawing="drawing",qe.moving="moving",qe.moveStart="moveStart",qe.moveEnd="moveEnd",qe.brushClear="brushClear";const Ze={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},Je=5,Ke={debounce:i.debounce,throttle:i.throttle};class Qe extends a{constructor(e){super(i.merge({},Qe.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const s=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=e=>{var i;const{removeOnClick:s=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&s?(this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={},this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:t.IOperateType.brushClear,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})):this._outOfInteractiveRange(e)||this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?t.IOperateType.drawEnd:t.IOperateType.moveEnd,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,null===(i=this._operatingMask)||void 0===i||i.setAttribute("pickable",!1)}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0,trigger:i=Ze.trigger,updateTrigger:s=Ze.updateTrigger,endTrigger:n=Ze.endTrigger,resetTrigger:a=Ze.resetTrigger}=this.attribute;this.stage.addEventListener(i,this._onBrushStart),this.stage.addEventListener(s,Ke[t](this._onBrushing,e)),this.stage.addEventListener(n,this._onBrushEnd),this.stage.addEventListener(a,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),s=this._container.getChildren();for(let t=0;t<s.length;t++){const{points:n=[],dx:a=0,dy:r=0}=s[t].attribute,l=n.map((t=>({x:t.x+a,y:t.y+r})));if(i.polygonContainPoint(l,e.x,e.y))return this._operatingMask=s[t],!0}return!1}_initDraw(e){const{brushMode:i}=this.attribute,s=this.eventPosToStagePos(e);this._cacheDrawPoints=[s],this._isDrawedBeforeEnd=!1,"single"===i&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:t.IOperateType.drawStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(e){var i,s;this._cacheMovePoint=this.eventPosToStagePos(e),this._operatingMaskMoveDx=null!==(i=this._operatingMask.attribute.dx)&&void 0!==i?i:0,this._operatingMaskMoveDy=null!==(s=this._operatingMask.attribute.dy)&&void 0!==s?s:0;const{interactiveRange:n}=this.attribute,{minY:a=-1/0,maxY:r=1/0,minX:l=-1/0,maxX:o=1/0}=n,{x1:d,x2:h,y1:u,y2:c}=this._operatingMask.globalAABBBounds,b=l-d,g=o-h,p=a-u,v=r-c;this._operatingMaskMoveRangeX=[b,g],this._operatingMaskMoveRangeY=[p,v],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:t.IOperateType.moveStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(e){var i;const s=this.eventPosToStagePos(e),{x1:n=0,x2:a=0,y1:r=0,y2:l=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds,{sizeThreshold:o=Je,brushType:d}=this.attribute,h=this._cacheDrawPoints.length;if(this._isDrawedBeforeEnd=!!(Math.abs(a-n)>o||Math.abs(r-l)>o),h>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(s.x===(null==t?void 0:t.x)&&s.y===(null==t?void 0:t.y))return}"polygon"===d||h<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[h-1]=s;const u=this._computeMaskPoints();this._operatingMask.setAttribute("points",u),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:t.IOperateType.drawing,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(e){const i=this._cacheMovePoint,s=this.eventPosToStagePos(e);if(s.x===(null==i?void 0:i.x)&&s.y===(null==i?void 0:i.y))return;const n=s.x-i.x,a=s.y-i.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,l=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],a))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:l}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:t.IOperateType.moving,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:s=[0,0]}=this.attribute;let n=[];const a=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[a,{x:r.x,y:a.y},r,{x:a.x,y:r.y}]:"x"===t?[{x:a.x,y:s[0]},{x:r.x,y:s[0]},{x:r.x,y:s[1]},{x:a.x,y:s[1]}]:"y"===t?[{x:e[0],y:a.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:a.y}]:i.cloneDeep(this._cacheDrawPoints),n}_addBrushMask(){var t;const{brushStyle:s,hasMask:n}=this.attribute,a=e.createPolygon(Object.assign(Object.assign({points:i.cloneDeep(this._cacheDrawPoints),cursor:"move",pickable:!1},s),{opacity:n?null!==(t=s.opacity)&&void 0!==t?t:1:0}));a.name=`brush-${Date.now()}`,this._operatingMask=a,this._container.add(a),this._brushMaskAABBBoundsDict[a.name]=a.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:a=1/0}=e,r=this.eventPosToStagePos(t);return r.x>a||r.x<n||r.y>s||r.y<i}eventPosToStagePos(t){var e,i,s;const n=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==n?void 0:n.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==n?void 0:n.top)||0)-((null===(s=this.stage)||void 0===s?void 0:s.y)||0)}}render(){this.bindBrushEvents();const t=this.createOrUpdateChild("brush-container",{},"group");this._container=t}setUpdateDragMaskCallback(t){i.isFunction(t)&&(this._updateDragMaskCallback=t)}releaseBrushEvents(){const{delayType:t="throttle",delayTime:e=0,trigger:i=Ze.trigger,updateTrigger:s=Ze.updateTrigger,endTrigger:n=Ze.endTrigger,resetTrigger:a=Ze.resetTrigger}=this.attribute;this.stage.removeEventListener(i,this._onBrushStart),this.stage.removeEventListener(s,Ke[t](this._onBrushing,e)),this.stage.removeEventListener(n,this._onBrushEnd),this.stage.removeEventListener(a,this._onBrushEnd)}}Qe.defaultAttributes=Ze;const ti=(t,...e)=>{const s=[t.shape,...e.map((t=>null==t?void 0:t.shape))],n=[t.key,...e.map((t=>null==t?void 0:t.key))],a=[t.value,...e.map((t=>null==t?void 0:t.value))];return i.merge(t,...e,{shape:s.every(i.isNil)?void 0:i.merge({},...s),key:n.every(i.isNil)?void 0:i.merge({},...n),value:a.every(i.isNil)?void 0:i.merge({},...a)})},ei=t=>{const{width:e,height:s,wordBreak:n="break-word",textAlign:a,textBaseline:r,text:l}=t;return{width:e,height:s,wordBreak:n,textAlign:a,textBaseline:r,singleLine:!1,textConfig:i.array(l).map((e=>Object.assign(Object.assign({},t),{text:e})))}},ii={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:E,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:E,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:E,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new i.AABBBounds).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},si=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"],ni="tooltip-title",ai="tooltip-content",ri="shape",li="value";class oi extends a{constructor(t){super(i.merge({},oi.defaultAttributes,t)),this.name="tooltip"}render(){const{visible:t,content:e,panel:s,keyWidth:n,valueWidth:a,hasContentShape:r,autoCalculatePosition:l,autoMeasure:o}=this.attribute;if(!t)return void this.hideAll();o&&oi.measureTooltip(this.attribute),l&&oi.calculateTooltipPosition(this.attribute);const d=i.normalizePadding(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},s),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild(ni,{visible:!0,x:d[3],y:d[0]},"group");const h=oi.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild(`${ni}-${ri}`,i.merge({symbolType:"circle"},h.shape,{visible:c(h)&&c(h.shape)}),"symbol"),h.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild(`${ni}-${li}`,Object.assign({visible:c(h)&&c(h.value)},ei(h.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild(`${ni}-${li}`,Object.assign({text:"",visible:c(h)&&c(h.value)},h.value),"text");const u=c(h.shape)?h.shape.size+h.shape.spacing:0,{textAlign:b,textBaseline:g}=h.value,p=s.width-d[3]-d[0]-u;"center"===b?this._tooltipTitle.setAttribute("x",u+p/2):"right"===b||"end"===b?this._tooltipTitle.setAttribute("x",u+p):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",h.height):"middle"===g?this._tooltipTitle.setAttribute("y",h.height/2):this._tooltipTitle.setAttribute("y",0);const v=c(h)?h.height+h.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild(ai,{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==e?void 0:e.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+v);let t=0;e.forEach(((e,s)=>{var l;const o=oi.getContentAttr(this.attribute,s);if(!c(o))return;const d=`${ai}-${s}`,h=this._tooltipContent.createOrUpdateChild(d,{visible:!0,x:0,y:t},"group");let u=0;if(c(o.shape)&&h.createOrUpdateChild(`${d}-${ri}`,Object.assign({visible:!0,x:o.shape.size/2,y:o.shape.size/2+((null!==(l=o.key.lineHeight)&&void 0!==l?l:o.key.fontSize)-o.shape.size)/2},o.shape),"symbol"),r&&(u+=o.shape.size+o.shape.spacing),c(o.key)){let t;t=o.key.multiLine?h.createOrUpdateChild(`${d}-key`,Object.assign(Object.assign({visible:!0},ei(o.key)),{textBaseline:"top"}),"richtext"):h.createOrUpdateChild(`${d}-key`,Object.assign(Object.assign({visible:!0},o.key),{textBaseline:"top"}),"text");const{textAlign:e}=o.key;"center"===e?t.setAttribute("x",u+n/2):"right"===e||"end"===e?t.setAttribute("x",u+n):t.setAttribute("x",u),t.setAttribute("y",0),u+=n+o.key.spacing}if(c(o.value)){let t;t=o.value.multiLine?h.createOrUpdateChild(`${d}-${li}`,Object.assign(Object.assign({visible:!0},ei(o.value)),{textBaseline:"top"}),"richtext"):h.createOrUpdateChild(`${d}-${li}`,Object.assign(Object.assign({visible:!0},o.value),{textBaseline:"top"}),"text");let e="right";i.isValid(o.value.textAlign)?e=o.value.textAlign:c(o.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+a/2):"right"===e||"end"===e?t.setAttribute("x",u+a):t.setAttribute("x",u),u+=a,t.setAttribute("y",0),h.add(t)}t+=o.height+o.spaceRow}))}}setAttributes(t,e){const s=Object.keys(t);this.attribute.autoCalculatePosition&&s.every((t=>si.includes(t)))?(this._mergeAttributes(t,s),i.isNil(this.attribute.panel.width)&&this.attribute.autoMeasure&&oi.measureTooltip(this.attribute),oi.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},e)):super.setAttributes(t,e)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:a,pointerY:r,positionX:l,positionY:o,parentBounds:d}=t;let h=a,u=r;return"left"===l?h-=e+s:"center"===l?h-=e/2:h+=s,"top"===o?u-=i+n:"middle"===o?u-=i/2:u+=n,h+e>d.x2&&(h-=e+s),u+i>d.y2&&(u-=i+n),h<d.x1&&(h=d.x1),u<d.y1&&(u=d.y1),t.x=h,t.y=u,t}static measureTooltip(t){const{content:s,contentStyle:n}=t,a=i.normalizePadding(t.padding),r=oi.getTitleAttr(t);let l=0,o=a[0]+a[2],d=0;const{value:h,shape:u}=r,{visible:b=!1,symbolType:g=""}=null!=u?u:{};if(i.isValid(h)){const{width:t,height:e}=M(h).quickMeasure(h.text);l=t,d=e}if(b&&e.builtinSymbolsMap[g]&&(l+=u.size+u.spacing,d=Math.max(u.size,d)),t.title&&(t.title.width=l,t.title.height=d),c(r)&&(o+=d+r.spaceRow),null==s?void 0:s.length){const i=[];if(s.forEach(((e,s)=>{const n=oi.getContentAttr(t,s);(e.key||e.value)&&c(n)&&i.push([e,n])})),i.length){let a=!1;const r=[],d=[],h=[];i.forEach((([t,s],l)=>{var u;const{key:b,value:g,shape:p,spaceRow:v}=s,m=c(p),_=null!==(u=null==p?void 0:p.symbolType)&&void 0!==u?u:"",y=M(b),x=M(g);let f=0;if(c(b)){const{width:t,height:e}=y.quickMeasure(b.text);d.push(t),f=Math.max(f,e)}if(c(g)){const{width:t,height:e}=x.quickMeasure(g.text);h.push(t),f=Math.max(f,e)}m&&e.builtinSymbolsMap[_]&&(a=!0,r.push(p.size),f=Math.max(p.size,f)),t.height=f,o+=f,l<i.length-1&&(o+=null!=v?v:n.spaceRow)}));const u=r.length?Math.max(...r):0,b=d.length?Math.max(...d):0,g=h.length?Math.max(...h):0;l=Math.max(b+g+n.key.spacing+n.value.spacing+(a?u+n.shape.spacing:0),l),s.forEach((t=>{t.width=l})),t.hasContentShape=a,t.keyWidth=b,t.valueWidth=g}}return t.panel.width=l+a[1]+a[3],t.panel.height=o,t}static getTitleAttr(t){return ti({},oi.defaultAttributes.titleStyle,oi.defaultAttributes.title,t.titleStyle,t.title)}static getContentAttr(t,e){return ti({},oi.defaultAttributes.contentStyle,t.contentStyle,t.content[e])}}oi.defaultAttributes=ii;t.AbstractComponent=a,t.ArcInfo=xt,t.ArcLabel=ft,t.BasePlayer=Xe,t.Brush=Qe,t.CircleAxis=$t,t.CircleAxisGrid=Jt,t.CircleCrosshair=F,t.ColorContinuousLegend=we,t.ContinuousPlayer=class extends Xe{constructor(i){super(i),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(je.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(je.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(je.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(je.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)}))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=e=>{const i=Math.floor(e);i!==this._activeIndex&&(this._dataIndex=i,this._activeIndex=i,i!==this._maxIndex&&this.dispatchCustomEvent(t.PlayerEventEnum.change))},this.play=()=>h(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(t.PlayerEventEnum.play),this._rafId=e.vglobal.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=e.vglobal.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,e.vglobal.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(t.PlayerEventEnum.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,e.vglobal.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(t.PlayerEventEnum.pause))},this.backward=()=>{const e=Date.now(),i=1*this._interval,s=this._elapsed-i;s<=0?(this._elapsed=0,this._startTime=e):(this._elapsed=s,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(t.PlayerEventEnum.backward)},this.forward=()=>{const e=Date.now(),i=1*this._interval,s=this._elapsed+i;s>=this._totalDuration?(this._startTime=e-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-i,this._elapsed=s),this._updateSlider(),this.dispatchCustomEvent(t.PlayerEventEnum.forward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}},t.DEFAULT_ITEM_SPACE_COL=pe,t.DEFAULT_ITEM_SPACE_ROW=ve,t.DEFAULT_LABEL_SPACE=8,t.DEFAULT_PAGER_SPACE=_e,t.DEFAULT_SHAPE_SIZE=10,t.DEFAULT_SHAPE_SPACE=8,t.DEFAULT_STATES=Mt,t.DEFAULT_TITLE_SPACE=me,t.DEFAULT_VALUE_SPACE=8,t.DataLabel=St,t.DataZoom=Qt,t.DiscreteLegend=Ee,t.DiscretePlayer=class extends Xe{constructor(s){super(i.merge({},s)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var e,s,n,a;super._initAttributes(),this._alternate=null!==(e=this.attribute.alternate)&&void 0!==e&&e,this._interval=null!==(s=this.attribute.interval)&&void 0!==s?s:1e3,this._direction=null!==(n=this.attribute.direction)&&void 0!==n?n:t.DirectionEnum.Default,this._dataIndex=i.isNil(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(a=this.attribute.dataIndex)&&void 0!==a?a:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(je.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(je.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(je.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(je.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(e=>{const i=Math.floor(e.detail.value)+.5;this._dataIndex=e.detail.value>=i?Math.ceil(e.detail.value):Math.floor(e.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(t.PlayerEventEnum.change)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(Fe({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||Ge({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===t.DirectionEnum.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(t.PlayerEventEnum.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=e.vglobal.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=i=>{const s=Date.now();if(this._isReachEnd&&s-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();i&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(t.PlayerEventEnum.change),this._activeIndex=this._dataIndex):s-this._tickTime>=this._interval&&(this._tickTime=s,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(t.PlayerEventEnum.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=e.vglobal.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),e.vglobal.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(t.PlayerEventEnum.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,e.vglobal.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(t.PlayerEventEnum.pause))},this.backward=()=>{const e=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(e),this.dispatchCustomEvent(t.PlayerEventEnum.change),this.dispatchCustomEvent(t.PlayerEventEnum.backward)},this.forward=()=>{const e=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(e),this.dispatchCustomEvent(t.PlayerEventEnum.change),this.dispatchCustomEvent(t.PlayerEventEnum.forward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}},t.GroupFadeIn=Ut,t.GroupFadeOut=Ft,t.GroupTransition=Wt,t.Indicator=class extends a{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:s,content:n,size:a,limitRatio:r=1/0}=this.attribute,l=Math.min(a.width,a.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(i.isValid(s))if(!1!==s.visible){const t=i.merge({},i.get(Oe,"title.style"),s.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:i.isValid(t.lineHeight)?t.lineHeight:t.fontSize,visible:s.visible,x:0,y:0}),"text"),s.autoFit&&i.isValidNumber(l)&&this._setAutoFit(l,this._title,s),s.autoLimit&&i.isValidNumber(r)&&this._title.setAttribute("maxLineWidth",l)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const d=this._title?this._title.AABBBounds.height():0;if(i.isValid(n)){const t=this._title&&(null==s?void 0:s.space)?s.space:0,e=i.array(n),a=[];let h=0;e.forEach(((e,s)=>{if(!1!==e.visible){const n=i.merge({},i.get(Oe,"content.style"),e.style),u=o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},n),{lineHeight:i.isValid(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:d+t+h}),"text");e.autoFit&&i.isValidNumber(l)&&this._setAutoFit(l,u,e),e.autoLimit&&i.isValidNumber(r)&&u.setAttribute("maxLineWidth",l),a.push(u);const c=(null==e?void 0:e.space)?e.space:0;h+=u.AABBBounds.height()+c}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=a}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",a.height/2-h/2),o.setAttribute("x",a.width/2)}_setAutoFit(t,e,s){var n,a,r,l,o,d;const h=B(null!==(a=null===(n=s.style)||void 0===n?void 0:n.text)&&void 0!==a?a:"",null!==(r=s.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(l=s.fitPercent)&&void 0!==l?l:.5)/h,a=Math.floor((null!==(d=null===(o=s.style)||void 0===o?void 0:o.fontSize)&&void 0!==d?d:20)*n);e.setAttribute("fontSize",a),e.setAttribute("lineHeight",i.isValid(s.style.lineHeight)?s.style.lineHeight:a)}}},t.LabelBase=ct,t.LineAxis=Nt,t.LineAxisGrid=Zt,t.LineCrosshair=W,t.LineLabel=pt,t.LinkPath=Ve,t.MarkArea=ue,t.MarkLine=he,t.MarkPoint=ce,t.Pager=ge,t.PolygonCrosshair=Y,t.PopTip=C,t.RectCrosshair=U,t.RectLabel=gt,t.ScrollBar=r,t.SectorCrosshair=G,t.Segment=Et,t.SizeContinuousLegend=Ce,t.Slider=Be,t.SymbolLabel=bt,t.Tag=w,t.Title=Pe,t.Tooltip=oi,t.VTag=function(t){return new w(t?t.attribute:{})},t.getHorizontalPath=Ie,t.getSizeHandlerPath=Te,t.getVerticalPath=He,t.loadPoptip=function(){e.container.load(D)},t.popTipModule=D,t.setPoptipTheme=function(t){i.merge(z.poptip,V,t)},t.version="0.15.3"}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@visactor/vrender"),require("@visactor/vutils"),require("@visactor/vscale")):"function"==typeof define&&define.amd?define(["exports","@visactor/vrender","@visactor/vutils","@visactor/vscale"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).VRender=t.VRender||{},t.VRender.Components={}),t.VRender,t.VUtils,t.VScale)}(this,(function(t,e,i,s){"use strict";const n=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class a extends e.Group{constructor(t,e="2d"){super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,s){!i.isPlainObject(this.attribute[t])||i.isFunction(this.attribute[t])||i.isFunction(e)?this.attribute[t]=e:i.merge(this.attribute[t],e),n.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!s&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>n.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){i.isNil(e)&&(e=Object.keys(t));for(let s=0;s<e.length;s++){const n=e[s];!i.isPlainObject(this.attribute[n])||i.isFunction(this.attribute[n])||i.isFunction(t[n])?this.attribute[n]=t[n]:i.merge(this.attribute[n],t[n])}}bindEvents(){}_getNodeId(t){return`${this.id}-${this.name}-${t}`}}class r extends a{constructor(t){super(i.merge({},r.defaultAttributes,t)),this.name="scrollbar",this._onRailPointerDown=t=>{var e,s;const{viewX:n,viewY:a}=t,{direction:r,width:l,height:o,range:d}=this.attribute,h=this._sliderSize,[u,c]=this._getScrollRange();let b;if("vertical"===r){const t=a-this._viewPosition.y,e=i.clamp(t-h/2,u,c);b=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=i.clamp(t-h/2,u,c);b=t/l,this._slider.setAttribute("x",e,!0)}this.setScrollRange([b-(d[1]-d[0])/2,b+(d[1]-d[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(s=this.stage)||void 0===s||s.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:i}=this.attribute;this._prePos="horizontal"===i?t.clientX:t.clientY,"browser"===e.vglobal.env?(e.vglobal.addEventListener("pointermove",this._onSliderPointerMove),e.vglobal.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,s,n=0;const a=this.getScrollRange(),{width:r,height:l}=this._getSliderRenderBounds();"vertical"===e?(s=t.clientY,n=s-this._prePos,i=n/l):(s=t.clientX,n=s-this._prePos,i=n/r),this.setScrollRange([a[0]+i,a[1]+i],!0),this._prePos=s},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===e.vglobal.env?(e.vglobal.removeEventListener("pointermove",this._onSliderPointerMove),e.vglobal.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t,e=!0){var s,n;const{direction:a="horizontal",limitRange:r=[0,1],range:l}=this.attribute,o=i.clampRange(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===a?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(s=this.stage)||void 0===s?void 0:s.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:l,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:s,range:n,limitRange:a=[0,1],railStyle:r,sliderStyle:l,padding:o=2}=this.attribute,d=this.createOrUpdateChild("scrollbar-container",{},"group"),h=d.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:s},r),"rect");this._rail=h;const u=this._getSliderRenderBounds(),c=this._getSliderPos(i.clampRange(n,a[0],a[1])),b=c[1]-c[0];let g;this._sliderSize=b,g="horizontal"===t?{x:c[0],y:u.y1,width:b,height:u.height}:{x:u.x1,y:c[0],width:u.width,height:b};const p=d.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},g),{cornerRadius:this._getDefaultSliderCornerRadius()}),l),{boundsPadding:i.normalizePadding(o),pickMode:"imprecise"}),"rect");this._slider=p,this._container=d;const v=this._container.AABBBounds;this._viewPosition={x:v.x1,y:v.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:s=2}=this.attribute,[n,a,r,l]=i.normalizePadding(s),o={x1:l,y1:n,x2:t-a,y2:e-r,width:t-(l+a),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:a}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+a,s*t[1]+a]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[s,n]=i.clampRange(t,0,1),{width:a,height:r,x1:l,y1:o}=this._getSliderRenderBounds(),d=this._sliderSize;return"horizontal"===e?i.clampRange([l+s*a,l+n*a],l,a-d):i.clampRange([o+s*r,o+n*r],o,r-d)}_onChange(t){var i;const s=new e.CustomEvent("scroll",t);s.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(s)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function o(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i}function d(t,e,i,s){var n,a=arguments.length,r=a<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"===("undefined"==typeof Reflect?"undefined":l(Reflect))&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(r=(a<3?n(r):a>3?n(e,i,r):n(e,i))||r);return a>3&&r&&Object.defineProperty(e,i,r),r}function h(t,e,i,s){return new(i||(i=Promise))((function(n,a){function r(t){try{o(s.next(t))}catch(t){a(t)}}function l(t){try{o(s.throw(t))}catch(t){a(t)}}function o(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,l)}o((s=s.apply(t,e||[])).next())}))}function u(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&u(t,e)}))}r.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]},"function"==typeof SuppressedError&&SuppressedError;const c=t=>!i.isNil(t)&&!1!==t.visible;const b=["#ffffff","#000000"];function g(t,e,i,s,n){const a=_(t),r=_(e);return p(a,r,i,s)?a:function(t,e,i,s,n){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n));a.push(...b);for(const n of a)if(t!==n&&p(n,e,i,s))return n;return}(a,r,i,s,n)}function p(t,e,i,s){return s?v(t,e)>s:"largeText"===i?v(t,e)>3:v(t,e)>4.5}function v(t,e){const i=m(t),s=m(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function m(t){const e=i.ColorUtil.hexToRgb(t),s=e[0]/255,n=e[1]/255,a=e[2]/255;let r,l,o;r=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),l=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4);return.2126*r+.7152*l+.0722*o}function _(t){if(null==t?void 0:t.includes("#"))return t;const e=new i.ColorUtil.Color(t),{r:s,g:n,b:a}=e.color;return"#"+i.ColorUtil.rgbToHex(s,n,a)}function y(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function x(t,e){return[t[0]*e,t[1]*e]}function f(t,e,i){const s=function(t,e){const[i,s]=t,[n,a]=e,r=Math.sqrt((i*i+s*s)*(n*n+a*a)),l=r&&(i*n+s*a)/r;return Math.acos(Math.min(Math.max(l,-1),1))}(t,e),n=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const A=-.5*Math.PI,S=1.5*Math.PI,E="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var L;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(L||(L={}));const k={[L.selectedReverse]:{},[L.selected]:{},[L.hover]:{},[L.hoverReverse]:{}},M=(t,s,n)=>new i.TextMeasure(Object.assign({defaultFontParams:{fontFamily:E,fontSize:11},getTextBounds:n?void 0:e.getTextBounds,specialCharSet:"-/: .,@%'\"~"+i.TextMeasure.ALPHABET_CHAR_SET+i.TextMeasure.ALPHABET_CHAR_SET.toUpperCase()},null!=s?s:{}),t);function B(t,i){var s;if(!t)return{width:0,height:0};const n=e.getTextBounds({text:t,fontFamily:i.fontFamily,fontSize:i.fontSize||12,fontWeight:i.fontWeight,textAlign:null!==(s=i.textAlign)&&void 0!==s?s:"center",textBaseline:i.textBaseline,ellipsis:!!i.ellipsis,maxLineWidth:i.maxLineWidth||1/0,lineHeight:i.fontSize||12});return{width:n.width(),height:n.height()}}class w extends a{constructor(t){super(i.merge({},w.defaultAttributes,t)),this.name="tag"}render(){var t;const{text:e="",textStyle:s={},shape:n={},panel:a={},space:r=4,minWidth:l,maxWidth:d,padding:h=4,visible:u,state:c}=this.attribute,b=i.normalizePadding(h),g=this.createOrUpdateChild("tag-content",{x:0,y:0,zIndex:1},"group");let p,v=b[1]+b[3],m=b[0]+b[2],_=0,y=0;const{visible:x}=n,f=o(n,["visible"]);if(i.isBoolean(x)){const t=(null==f?void 0:f.size)||10,e=i.isNumber(t)?t:Math.max(t[0],t[1]);p=g.createOrUpdateChild("tag-shape",Object.assign(Object.assign({symbolType:"circle",size:t,strokeBoundsBuffer:0},f),{visible:x,x:e/2,y:e/2}),"symbol"),i.isEmpty(null==c?void 0:c.shape)||(p.states=c.shape),x&&(y=e+r)}v+=y,_+=y;const A=Object.assign(Object.assign({text:e,visible:i.isValid(e)&&!1!==u,lineHeight:null==s?void 0:s.fontSize},s),{x:_,y:0});i.isNil(A.lineHeight)&&(A.lineHeight=A.fontSize);const S=g.createOrUpdateChild("tag-text",A,"text");i.isEmpty(null==c?void 0:c.text)||(S.states=c.text);const E=B(A.text,s),L=E.width,k=E.height;v+=L;const M=null!==(t=n.size)&&void 0!==t?t:10,w=i.isNumber(M)?M:Math.max(M[0],M[1]);m+=Math.max(k,(null==n?void 0:n.visible)?w:0);const{textAlign:T,textBaseline:C}=s;(i.isValid(l)||i.isValid(d))&&(i.isValid(l)&&v<l&&(v=l),i.isValid(d)&&v>d&&(v=d,S.setAttribute("maxLineWidth",d-b[1]-b[2])));let P=0,O=0;"center"===T?(P-=v/2,p&&p.setAttribute("x",(p.attribute.x||0)-L/2),g.setAttribute("x",-y/2)):"right"===T||"end"===T?(P-=v,p&&p.setAttribute("x",(p.attribute.x||0)-L),g.setAttribute("x",-b[1]-y)):"left"!==T&&"start"!==T||g.setAttribute("x",b[3]),"middle"===C?(O-=m/2,p&&p.setAttribute("y",0)):"bottom"===C?(O-=m,p&&p.setAttribute("y",-k/2),g.setAttribute("y",-b[2])):"top"===C&&(g.setAttribute("y",b[0]),p&&p.setAttribute("y",k/2));const{visible:I}=a,H=o(a,["visible"]);if(u&&i.isBoolean(I)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},H),{visible:I&&!!e,x:P,y:O,width:v,height:m}),"rect");i.isEmpty(null==c?void 0:c.panel)||(t.states=c.panel)}}}w.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const T=new i.AABBBounds;class C extends a{constructor(t){super(i.merge({},C.defaultAttributes,t)),this.name="poptip",this.positionList=["top","tl","tr","bottom","bl","br","left","lt","lb","right","rt","rb"]}render(){var t,e,s,n,a,r,l,d;const{titleStyle:h={},position:u,contentStyle:c={},panel:b={},space:g=4,minWidth:p=0,maxWidth:v=1/0,padding:m=4,maxWidthPercent:_,visible:y,state:x,dx:f=0,dy:A=0}=this.attribute;let{title:S="",content:E=""}=this.attribute;S=this.attribute.titleFormatMethod?this.attribute.titleFormatMethod(S):S,E=this.attribute.contentFormatMethod?this.attribute.contentFormatMethod(E):E;const L=i.normalizePadding(m),k=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group"),M=v-L[1]-L[3],B=i.isValid(S)&&!1!==y,w=Object.assign(Object.assign({text:i.isArray(S)?S:[S],visible:B},h),{x:L[3],y:L[0],maxLineWidth:M,textAlign:"left",textBaseline:"top"}),C=k.createOrUpdateChild("poptip-title",w,"wrapText");i.isEmpty(null==x?void 0:x.title)||(C.states=x.title);const P=C.AABBBounds,O=P.height(),I=P.width();let H=O+g;B||(H=0);const V=i.isValid(E)&&!1!==y,z=Object.assign(Object.assign({text:i.isArray(E)?E:[E],visible:V},c),{x:L[3],y:L[0]+H,maxLineWidth:M,textAlign:"left",textBaseline:"top"}),j=k.createOrUpdateChild("poptip-content",z,"wrapText");i.isEmpty(null==x?void 0:x.content)||(j.states=x.content);const R=j.AABBBounds,N=R.height(),D=R.width();V&&(H+=N);let $=i.max(I+L[1]+L[3],D+L[1]+L[3]);$>v?$=v:$<p&&($=p);let W=L[0]+L[2]+H;const{visible:U}=b,F=o(b,["visible"]),G=null!==(t=F.size)&&void 0!==t?t:12,Y=i.isArray(G)?[G[0]+(null!==(e=F.space)&&void 0!==e?e:0),G[1]+(null!==(s=F.space)&&void 0!==s?s:0)]:G+(null!==(n=F.space)&&void 0!==n?n:0),X=null!==(a=F.lineWidth)&&void 0!==a?a:1,q=this.stage?[null!==(r=this.stage.viewWidth)&&void 0!==r?r:this.stage.width,null!==(l=this.stage.viewHeight)&&void 0!==l?l:this.stage.height]:void 0;if(q){const t=this.AABBBounds,e=null!==(d=this.attribute.x)&&void 0!==d?d:t.x1,s=q[0]-t.x1;let n=Math.max(e,s);const a=(i.isArray(G)?G[0]:12)+3;if(n=Math.min(n-a,n*_),n<$){$=n;const t=L[1]+L[3];C.setAttribute("maxLineWidth",n-t),j.setAttribute("maxLineWidth",n-t),W=L[0]+L[2],B&&(W+=C.AABBBounds.height()+g),W+=j.AABBBounds.height()}}const Z="auto"===u;let J,K=-1/0;for(let t=0;t<this.positionList.length+1;t++){const e=Z?this.positionList[t===this.positionList.length?J:t]:u,{angle:s,offset:n,rectOffset:a}=this.getAngleAndOffset(e,$,W,i.isArray(Y)?Y:[Y,Y-X]);if(i.isBoolean(U)){const t=(i.isArray(G)?G[0]:G)/4,e=k.createOrUpdateChild("poptip-symbol-panel",Object.assign(Object.assign({},F),{visible:U&&(V||B),x:t,y:0,strokeBoundsBuffer:-1,boundsPadding:-2,anchor:[0,0],symbolType:"arrow2Left",angle:s,dx:n[0],dy:n[1],size:G,zIndex:-9}),"symbol");i.isEmpty(null==x?void 0:x.panel)||(e.states=x.panel);const a=k.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},F),{visible:U&&(V||B),x:0,y:0,width:$,height:W,zIndex:-8}),"rect");i.isEmpty(null==x?void 0:x.panel)||(a.states=x.panel)}if(k.setAttributes({x:-n[0]+f,y:-n[1]+A}),!Z||!q)break;{T.setValue(0,0,$,W).transformWithMatrix(k.globalTransMatrix);const e=T,s=(new i.Bounds).setValue(0,0,q[0],q[1]);if(i.rectInsideAnotherRect(e,s,!1))break;{const n=i.getRectIntersect(e,s,!1),a=(n.x2-n.x1)*(n.y2-n.y1);a>K&&(K=a,J=t)}}}}getAngleAndOffset(t,e,s,n){const a=n[1]/2;switch(t){case"tl":return{angle:i.pi/2*3,offset:[e/4,s+a],rectOffset:[-e/4,-s-n[1]]};case"top":return{angle:i.pi/2*3,offset:[e/2,s+a],rectOffset:[0,-s-n[1]]};case"tr":return{angle:i.pi/2*3,offset:[e/4*3,s+a],rectOffset:[e/4*3,-s-n[1]]};case"rt":return{angle:0,offset:[-a,s/5],rectOffset:[e/4*3,-s-n[1]]};case"right":return{angle:0,offset:[-a,s/2],rectOffset:[e/4*3,-s-n[1]]};case"rb":return{angle:0,offset:[-a,s/5*4],rectOffset:[e/4*3,-s-n[1]]};case"bl":return{angle:i.pi/2,offset:[e/4,-a],rectOffset:[-e/4,-s-n[1]]};case"bottom":return{angle:i.pi/2,offset:[e/2,-a],rectOffset:[0,-s-n[1]]};case"br":return{angle:i.pi/2,offset:[e/4*3,-a],rectOffset:[e/4*3,-s-n[1]]};case"lt":return{angle:i.pi,offset:[e+a,s/5],rectOffset:[-e/4,-s-n[1]]};case"left":return{angle:i.pi,offset:[e+a,s/2],rectOffset:[0,-s-n[1]]};case"lb":return{angle:i.pi,offset:[e+a,s/5*4],rectOffset:[e/4*3,-s-n[1]]}}}}C.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};const P={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},O={poptip:i.merge({},P)};let I=class{render(t,e,s,n,a,r,l,o,d,h,u,c,b){var g,p,v;if(1===t._showPoptip){const{visible:e,visibleCb:s}=t.attribute.poptip||{};if(!1===e||s&&!1===s(t))return;const n={};i.merge(n,C.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(n):this.poptipComponent=new C(n);let a=t.attribute.poptip||{};if("text"===t.type&&null==a.title&&null==a.content){const e={};p=e,v=a,i.merge(p,O.poptip,v),a=e,a.content=null!==(g=a.content)&&void 0!==g?g:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},a),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const l=h.stage.getLayer("_builtin_interactive");l&&l.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};I=d([e.injectable()],I);let H=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=e.Generator.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};H=d([e.injectable()],H);let V=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=e.Generator.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};V=d([e.injectable()],V);const z=new e.ContainerModule(((t,i,s,n)=>{s(I)||(t(I).toSelf().inSingletonScope(),t(e.InteractiveSubRenderContribution).toService(I)),s(H)||(t(H).toSelf(),t(e.AutoEnablePlugins).toService(H)),s(V)||(t(V).toSelf(),t(e.AutoEnablePlugins).toService(V))}));class j extends a{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class R extends j{constructor(t){super(i.merge({},R.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}R.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class N extends j{constructor(t){super(i.merge({},N.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}N.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class D extends j{constructor(t){super(i.merge({},D.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,s=i.PointService.distancePP(t,e);this.setAttribute("radius",s)}}D.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class $ extends j{constructor(t){super(i.merge({},$.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:a,endAngle:r}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:a,endAngle:r}),n),"arc")}setLocation(t){const{center:e,startAngle:s=A,endAngle:n=S}=this.attribute,a=n-s,r=i.radianToDegree(i.getAngleByPoint(e,t));this.setAttributes({startAngle:r-a/2,endAngle:r+a/2})}}$.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class W extends j{constructor(t){super(i.merge({},W.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:s,sides:n=6,lineStyle:a}=this.attribute,{startAngle:r,endAngle:l}=this.attribute,o=(l-r)%(2*Math.PI)==0,d=(l-r)/n;let h;for(let t=0;t<=n;t++){const a=r+d*t,l=i.polarToCartesian(e,s,a);0===t?h=`M${l.x},${l.y}`:h+=`L${l.x},${l.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},a),"path")}setLocation(t){const{center:e}=this.attribute,s=i.PointService.distancePP(t,e);this.setAttribute("radius",s)}}W.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const U=5,F=31,G=32,Y=new Uint32Array(G+1),X=new Uint32Array(G+1);X[0]=0,Y[0]=~X[0];for(let t=1;t<=G;++t)X[t]=X[t-1]<<1|1,Y[t]=~X[t];function q(t,e,i=0){const s=Math.max(1,Math.sqrt(t*e/1e6)),n=~~((t+2*i+s)/s),a=~~((e+2*i+s)/s),r=t=>~~((t+i)/s);return r.invert=t=>t*s-i,r.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+G)/G));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>U]&1<<(n&F)},set:(e,i)=>{const n=i*t+e;s(n>>>U,1<<(n&F))},clear:(e,i)=>{const s=i*t+e;n(s>>>U,~(1<<(s&F)))},getRange:({x1:s,y1:n,x2:a,y2:r})=>{if(a<0||r<0||s>t||n>e)return!0;let l,o,d,h,u=r;for(;u>=n;--u)if(l=u*t+s,o=u*t+a,d=l>>>U,h=o>>>U,d===h){if(i[d]&Y[l&F]&X[1+(o&F)])return!0}else{if(i[d]&Y[l&F])return!0;if(i[h]&X[1+(o&F)])return!0;for(let t=d+1;t<h;++t)if(i[t])return!0}return!1},setRange:({x1:i,y1:n,x2:a,y2:r})=>{if(a<0||r<0||i>t||n>e)return;let l,o,d,h,u;for(;n<=r;++n)if(l=n*t+i,o=n*t+a,d=l>>>U,h=o>>>U,d===h)s(d,Y[l&F]&X[1+(o&F)]);else for(s(d,Y[l&F]),s(h,X[1+(o&F)]),u=d+1;u<h;++u)s(u,4294967295)},clearRange:({x1:e,y1:i,x2:s,y2:a})=>{let r,l,o,d,h;for(;i<=a;++i)if(r=i*t+e,l=i*t+s,o=r>>>U,d=l>>>U,o===d)n(o,X[r&F]|Y[1+(l&F)]);else for(n(o,X[r&F]),n(d,Y[1+(l&F)]),h=o+1;h<d;++h)n(h,0)},outOfBounds:({x1:i,y1:s,x2:n,y2:a})=>i<0||s<0||a>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),a=n.data;for(let s=0;s<e;++s)for(let e=0;e<t;++e){const n=s*t+e,r=4*n,l=i[n>>>U]&1<<(n&F);a[r+0]=255*l,a[r+1]=255*l,a[r+2]=255*l,a[r+3]=31}return n}}}(n,a),r.ratio=s,r.padding=i,r.width=t,r.height=e,r}function Z(t,e,s=!1){if(s){const{x1:s,x2:n,y1:a,y2:r}=e,l=i.clamp(s,0,t.width),o=i.clamp(n,0,t.width),d=i.clamp(a,0,t.height),h=i.clamp(r,0,t.height);return{x1:t(l),x2:t(o),y1:t(d),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function J(t,e,i,s=!0,n=0){let a=i;n>0&&(a={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),a=Z(t,a);return!(s&&e.outOfBounds(a))&&!e.getRange(a)}function K(t,e,s,n=[],a=!0,r=0){const l=n.filter((t=>i.isValid(t)));for(let i=0;i<l.length;i++){const n=s.clone();if(n.setAttributes(l[i]),n.update(),J(t,e,Z(t,n.AABBBounds),a,r))return e.setRange(Z(t,n.AABBBounds,!0)),l[i]}return!1}function Q(t,e,s,n,a,r,l){var o,d;const h=null===(o=n.overlap)||void 0===o?void 0:o.clampForce,u=null===(d=n.overlap)||void 0===d?void 0:d.overlapPadding;if("bound"===s.type||"position"===s.type){if(i.isFunction(l)){const o=((i.isFunction(s.position)?s.position(a.attribute):s.position)||function(t){if("rect"===t)return et;return tt}(n.type)).map((t=>l(a.AABBBounds,r,t,n.offset)));return K(t,e,a,o,h,u)}return!1}if("moveY"===s.type){const n=(s.offset?i.isFunction(s.offset)?s.offset(a.attribute):s.offset:[]).map((t=>({x:a.attribute.x,y:a.attribute.y+t})));return K(t,e,a,n,h,u)}if("moveX"===s.type){const n=(s.offset?i.isFunction(s.offset)?s.offset(a.attribute):s.offset:[]).map((t=>({x:a.attribute.x+t,y:a.attribute.y})));return K(t,e,a,n,h,u)}return!1}const tt=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],et=["top","inside-top","inside"];function it(t,e,i){const{x1:s,x2:n,y1:a,y2:r}=t.AABBBounds,l=Math.min(s,n),o=Math.max(s,n),d=Math.min(a,r),h=Math.max(a,r);let u=0,c=0;return l<0&&o-l<=e?u=-l:o>e&&l-(o-e)>=0&&(u=e-o),d<0&&h-d<=i?c=-d:h>i&&d-(h-i)>=0&&(c=i-h),{dx:u,dy:c}}const st={fadeIn:(t={})=>{var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:(t={})=>{var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function nt(t,e){var i,s;return null!==(s=null===(i=st[e])||void 0===i?void 0:i.call(st,t))&&void 0!==s?s:{from:{},to:{}}}const at="same-time",rt=300,lt="linear";class ot extends a{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t){super(i.merge({},ot.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||i.isEmpty(e.states)||(e.addState(L.hover,!0),u(this,(t=>{t===e||i.isEmpty(t.states)||t.addState(L.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(u(this,(t=>{i.isEmpty(t.states)||(t.removeState(L.hoverReverse),t.removeState(L.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void u(this,(t=>{i.isEmpty(t.states)||(t.removeState(L.selectedReverse),t.removeState(L.selected))}));i.isEmpty(e.states)||(e.addState(L.selected,!0),u(this,(t=>{t===e||i.isEmpty(t.states)||t.addState(L.selectedReverse,!0)})),this._lastSelect=e)}}labeling(t,e,i,s){}_labelLine(t){}render(){if(this._prepare(),i.isNil(this._idToGraphic))return;const{overlap:t,smartInvert:e,dataFilter:s,customLayoutFunc:n,customOverlapFunc:a}=this.attribute;let r,l=this.attribute.data;i.isFunction(s)&&(l=s(l)),r=i.isFunction(n)?n(l,(t=>this._idToGraphic.get(t.id))):this._layout(l),i.isFunction(a)?r=a(r,(t=>this._idToGraphic.get(t.id))):!1!==t&&(r=this._overlapping(r)),!1!==e&&this._smartInvert(r),this._renderLabels(r)}_bindEvent(t){if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!i.isEmpty(e)&&(t.states=e)}_createLabelText(t){const i=e.createText(t);return this._bindEvent(i),this._setStates(i),i}_prepare(){var t;const e=[];let s;if(s=i.isFunction(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&e.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),this._baseMarks=e,!e||0===e.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){this._idToGraphic||(this._idToGraphic=new Map);for(let t=0;t<e.length;t++){const s=n[t],a=e[t];s&&a&&(i.isValid(s.id)||(s.id=`vrender-component-${this.name}-${t}`),this._idToGraphic.set(s.id,a))}}}_layout(t=[]){const{textStyle:e={},position:s,offset:n}=this.attribute,a=[];for(let r=0;r<t.length;r++){const l=t[r],o=this._idToGraphic.get(l.id),d=Object.assign(Object.assign({fill:o.attribute.fill},e),l),h=this._createLabelText(d),u=this.getGraphicBounds(h),c=this.getGraphicBounds(o,{x:l.x,y:l.y}),b=this.labeling(u,c,i.isFunction(s)?s(l):s,n);b&&(d.x=b.x,d.y=b.y,h.setAttributes(b)),a.push(h)}return a}_overlapping(t){var e,s,n,a;if(0===t.length)return[];const r=this.attribute.overlap,l=[],o=this.getBaseMarkGroup(),d=null!==(e=r.size)&&void 0!==e?e:{width:null!==(s=null==o?void 0:o.AABBBounds.width())&&void 0!==s?s:0,height:null!==(n=null==o?void 0:o.AABBBounds.height())&&void 0!==n?n:0};if(0===d.width||0===d.height)return t;const{avoidBaseMark:h,strategy:u=[],hideOnHit:c=!0,clampForce:b=!0,avoidMarks:g=[],overlapPadding:p}=r,v=this._bmpTool||q(d.width,d.height),m=this._bitmap||v.bitmap(),_=u.some((t=>"bound"===t.type));h&&(null===(a=this._baseMarks)||void 0===a||a.forEach((t=>{t.AABBBounds&&m.setRange(Z(v,t.AABBBounds,!0))}))),g.length>0&&g.forEach((t=>{i.isString(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&m.setRange(Z(v,t.AABBBounds,!0))})):t.AABBBounds&&m.setRange(Z(v,t.AABBBounds,!0))}));for(let e=0;e<t.length;e++){if(!1===t[e].visible)continue;const s=t[e],n=this._idToGraphic.get(s.attribute.id);if(s.update(),!i.isRectIntersect(n.AABBBounds,{x1:0,x2:v.width,y1:0,y2:v.height},!0))continue;if(J(v,m,s.AABBBounds,b,p)){if(!_){m.setRange(Z(v,s.AABBBounds,!0)),l.push(s);continue}if(_&&(null==n?void 0:n.AABBBounds)&&this._canPlaceInside(s.AABBBounds,null==n?void 0:n.AABBBounds)){m.setRange(Z(v,s.AABBBounds,!0)),l.push(s);continue}}let a=!1;for(let i=0;i<u.length;i++)if(a=Q(v,m,u[i],this.attribute,s,this.getGraphicBounds(n,t[e]),this.labeling),!1!==a){s.setAttributes({x:a.x,y:a.y}),l.push(s);break}if(!a&&b){const{dx:t=0,dy:e=0}=it(s,v.width,v.height);if((0!==t||0!==e)&&J(v,m,{x1:s.AABBBounds.x1+t,x2:s.AABBBounds.x2+t,y1:s.AABBBounds.y1+e,y2:s.AABBBounds.y2+e},void 0,p)){s.setAttributes({x:s.attribute.x+t,y:s.attribute.y+e}),m.setRange(Z(v,s.AABBBounds,!0)),l.push(s);continue}}!a&&!c&&l.push(s)}return i.isFunction(this.onAfterLabelOverlap)&&this.onAfterLabelOverlap(m),l}getBaseMarkGroup(){const{baseMarkGroupName:t}=this.attribute;if(t)return this.getRootNode().find((e=>e.name===t),!0)}getGraphicBounds(t,e={}){return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var s,n,a,r,l;const o=null!==(s=this.attribute.animation)&&void 0!==s?s:{},d=null!==(n=o.mode)&&void 0!==n?n:at,h=null!==(a=o.duration)&&void 0!==a?a:rt,u=null!==(r=o.easing)&&void 0!==r?r:lt,c=null!==(l=o.delay)&&void 0!==l?l:0,b=new Map,g=this._graphicToText||new Map,p=[];t.forEach(((t,s)=>{var n,a,r,l,v,m,_;const y=this._labelLine(t),x=this._idToGraphic.get(t.attribute.id),f=(null==g?void 0:g.get(x))?"update":"enter";if("enter"===f){if(p.push(t),b.set(x,y?{text:t,labelLine:y}:{text:t}),x){const{from:e,to:i}=nt(t.attribute,"fadeIn");this.add(t),y&&this.add(y),x.once("animate-bind",(()=>{t.setAttributes(e);const n=this._afterRelatedGraphicAttributeUpdate(t,p,s,x,{mode:d,duration:h,easing:u,to:i,delay:c});x.on("afterAttributeUpdate",n)}))}}else if("update"===f){const s=g.get(x);g.delete(x),b.set(x,s);const d=s.text;d.animate().to(t.attribute,h,u),s.labelLine&&s.labelLine.animate().to(i.merge({},s.labelLine.attribute,{visible:null===(m=null!==(l=(null===(a=null===(n=t.attribute)||void 0===n?void 0:n.line)||void 0===a?void 0:a.visible)&&(null===(r=t.attribute)||void 0===r?void 0:r.visible))&&void 0!==l?l:null===(v=t.attribute)||void 0===v?void 0:v.visible)||void 0===m||m,points:null===(_=t.attribute)||void 0===_?void 0:_.points}),h,u),!1!==o.increaseEffect&&d.attribute.text!==t.attribute.text&&i.isValidNumber(Number(d.attribute.text)*Number(t.attribute.text))&&d.animate().play(new e.IncreaseCount({text:d.attribute.text},{text:t.attribute.text},h,u))}})),g.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(nt(t.text.attribute,"fadeOut").to,h,u).onEnd((()=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)}))})),this._graphicToText=b}_renderWithOutAnimation(t){const e=new Map,i=this._graphicToText||new Map;t.forEach((t=>{var s;const n=this._labelLine(t),a=this._idToGraphic.get(t.attribute.id),r=(null==i?void 0:i.get(a))?"update":"enter";if("enter"===r)e.set(a,n?{text:t,labelLine:n}:{text:t}),this.add(t),n&&this.add(n);else if("update"===r){const n=i.get(a);i.delete(a),e.set(a,n),n.text.setAttributes(t.attribute),(null==n?void 0:n.labelLine)&&n.labelLine.setAttributes({points:null===(s=t.attribute)||void 0===s?void 0:s.points})}})),i.forEach((t=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)})),this._graphicToText=e}_afterRelatedGraphicAttributeUpdate(t,i,s,n,{mode:a,duration:r,easing:l,to:o,delay:d}){const h=u=>{var c;const{detail:b}=u;if(!b)return{};if(!(b&&b.type===e.AttributeUpdateType.ANIMATE_UPDATE&&b.animationState&&"wait"!==(null===(c=b.animationState.step)||void 0===c?void 0:c.type)))return{};if(b.type===e.AttributeUpdateType.ANIMATE_END)return void t.setAttributes(o);const g=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",h))};switch(a){case"after":b.animationState.end&&t.animate({onEnd:g}).wait(d).to(o,r,l);break;case"after-all":s===i.length-1&&b.animationState.end&&i.forEach((t=>{t.animate({onEnd:g}).wait(d).to(o,r,l)}));break;default:b.animationState.isFirstFrameOfStep&&t.animate({onEnd:g}).wait(d).to(o,r,l)}};return h}_smartInvert(t){var e,i,s,n;const a=this.attribute.smartInvert||{},{textType:r,contrastRatiosThreshold:l,alternativeColors:o}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",h=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",u=null!==(s=a.brightColor)&&void 0!==s?s:"#ffffff",c=null!==(n=a.darkColor)&&void 0!==n?n:"#000000";if("null"!==d||"null"!==h)for(let e=0;e<t.length;e++){const i=t[e];if(!i)continue;const s=this._idToGraphic.get(i.attribute.id),n=this._canPlaceInside(i.AABBBounds,null==s?void 0:s.AABBBounds),a=s.attribute.fill,b=a,v=g(i.attribute.fill,a,r,l,o),m=p(v,u)?u:c;if(n){const t=y(d,b,v,m);if(t&&i.setAttributes({fill:t}),0===i.attribute.lineWidth)continue;const e=y(h,b,v,m);e&&i.setAttributes({stroke:e})}else{if(0===i.attribute.lineWidth)continue;if(i.attribute.stroke){i.setAttributes({fill:g(i.attribute.fill,i.attribute.stroke,r,l,o)});continue}const t=y(d,b,v,m);t&&i.setAttributes({fill:t});const e=y(h,b,v,m);e&&i.setAttributes({stroke:e})}}}_canPlaceInside(t,e){return!(!t||!e)&&e.encloses(t)}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}ot.defaultAttributes={textStyle:{fontSize:12,textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},offset:0,pickable:!1};class dt extends ot{constructor(t){super(i.merge({},dt.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e,i="top",s=0){if(!t)return;const{x1:n,y1:a,x2:r,y2:l}=t,o=Math.abs(r-n),d=Math.abs(l-a),h=(e.x1+e.x2)/2,u=(e.y1+e.y2)/2;let c=0,b=0,g=0,p=0;e&&(g=Math.abs(e.x1-e.x2)/2,p=Math.abs(e.y1-e.y2)/2);const v={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":b=-1;break;case"bottom":b=1;break;case"left":c=-1;break;case"right":c=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":c=Math.sin(v[i]*(Math.PI/180)),b=Math.cos(v[i]*(Math.PI/180));break;case"center":c=0,b=0}return{x:h+c*(s+g)+Math.sign(c)*(o/2),y:u+b*(s+p)+Math.sign(b)*(d/2)}}}dt.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ht extends ot{constructor(t){super(i.merge({},ht.defaultAttributes,t))}labeling(t,e,i="top",s=0){if(!t||!e)return;const{x1:n,y1:a,x2:r,y2:l}=t,o=Math.abs(r-n),d=Math.abs(l-a),h=Math.abs(e.x2-e.x1),u=Math.abs(e.y2-e.y1);let c=(e.x1+e.x2)/2,b=(e.y1+e.y2)/2,g=0,p=0;switch(i){case"top":case"inside-top":p=-.5;break;case"bottom":case"inside-bottom":p=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}c+=g*h,b+=p*u;let v=0,m=0;const _=i.includes("inside");i.includes("top")?m=_?1:-1:i.includes("bottom")?m=_?-1:1:i.includes("left")?v=_?1:-1:i.includes("right")&&(v=_?-1:1);return{x:c+v*s+v*o/2,y:b+m*s+m*d/2}}}ht.tag="rect-label",ht.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ut extends ot{constructor(t){super(i.merge({},ut.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t,e={}){var i;if("line"!==t.type)return super.getGraphicBounds(t,e);const{position:s="end"}=this.attribute,n=(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)||[e],a="start"===s?0:n.length-1;return{x1:n[a].x,x2:n[a].x,y1:n[a].y,y2:n[a].y}}labeling(t,e,i="end",s=0){if(!t||!e)return;const{x1:n,x2:a}=t,r=Math.abs(a-n),l=e.x1;let o=l;return"end"===i?o=l+r/2+s:"start"===i&&(o=l-r/2-s),{x:o,y:e.y1}}}function ct(t,e,i,s){const n=(a={radius:i,angle:s}).radius?{x:Math.cos(a.angle)*a.radius,y:Math.sin(a.angle)*a.radius}:{x:0,y:0};var a;return{x:t+n.x,y:e+n.y}}function bt(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function gt(t){return 3===t||4===t}function pt(t,e){const{x1:i,y1:s,x2:n,y2:a}=t,{x1:r,y1:l,x2:o,y2:d}=e;return!(i<=r&&n<=r||i>=o&&n>=o||s<=l&&a<=l||s>=d&&a>=d)}ut.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"end",offset:6,pickable:!1};class vt{constructor(t,e,i,s,n,a,r,l,o){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=n,this.middleAngle=a,this.innerRadius=r,this.outerRadius=l,this.circleCenter=o,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class mt extends ot{constructor(t){super(i.merge({},mt.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e,i="outside",s=0){if(t&&e)return{x:0,y:0}}_layout(t=[]){const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),s=Object.assign(Object.assign({},this.attribute.textStyle),{text:"..."}),n=this._createLabelText(s),a=this.getGraphicBounds(n),r=a.x2-a.x1,l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),t,i,r);for(let i=0;i<t.length;i++){const s=t[i],n=l.find((t=>t.refDatum.id===s.id)),a={visible:n.labelVisible,x:n.labelPosition.x,y:n.labelPosition.y,angle:n.angle,maxLineWidth:n.labelLimit,points:(null==n?void 0:n.pointA)&&(null==n?void 0:n.pointB)&&(null==n?void 0:n.pointC)?[n.pointA,n.pointB,n.pointC]:void 0,line:null==n?void 0:n.labelLine};e[i].setAttributes(a)}return e}layoutArcLabels(t,e,i,s,n,a){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=a;let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)})),i.forEach(((t,i)=>{var a,l;const o=t.attribute,d={x:null!==(a=null==o?void 0:o.x)&&void 0!==a?a:0,y:null!==(l=null==o?void 0:o.y)&&void 0!==l?l:0},h=s[i],u=n[i],c=(o.startAngle+o.endAngle)/2,b=o.endAngle-o.startAngle,g=bt(o.endAngle-b/2),p=ct(d.x,d.y,o.outerRadius,c),v=ct(d.x,d.y,r+e.line.line1MinLength,c),m=new vt(h,p,v,g,b,c,o.innerRadius,o.outerRadius,d);var _;m.pointA=ct(d.x,d.y,this.computeDatumRadius(2*d.x,2*d.y,o.outerRadius),m.middleAngle),m.labelSize={width:u.x2-u.x1,height:u.y2-u.y1},1===(_=m.quadrant)||2===_?this._arcRight.set(m.refDatum,m):gt(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}));const l=Array.from(this._arcLeft.values()),o=Array.from(this._arcRight.values()),d=[];return"inside"===t?(d.push(...this._layoutInsideLabels(o,e,i)),d.push(...this._layoutInsideLabels(l,e,i))):(d.push(...this._layoutOutsideLabels(o,e,i)),d.push(...this._layoutOutsideLabels(l,e,i))),d}_layoutInsideLabels(t,e,s){const n=e,a=n.spaceWidth;return t.forEach((t=>{var s,r;const{labelSize:l,radian:o}=t,d=t.innerRadius,h=t.outerRadius,u=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,l.height);let c;if(o<u)c=0;else{let t;t=o>=Math.PI?d:Math.max(d,l.height/2/Math.tan(o/2)),c=h-t-a}!0!==(null==n?void 0:n.rotate)&&(c=h-a);const b=this._getFormatLabelText(t.refDatum,c);t.labelText=b;const g=Math.min(c,t.labelSize.width),p=this._computeAlign(t,e),v=h-a-("left"===p?g:"right"===p?0:g/2);t.labelPosition=ct(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=g,i.isGreater(g,0)||(t.labelVisible=!1),t.angle=null!==(r=null===(s=null==e?void 0:e.textStyle)||void 0===s?void 0:s.angle)&&void 0!==r?r:t.middleAngle})),t}_layoutOutsideLabels(t,e,s){var n,a,r,l,o;const d=null!==(a=null===(n=s[0].attribute)||void 0===n?void 0:n.x)&&void 0!==a?a:0,h=2*(null!==(l=null===(r=s[0].attribute)||void 0===r?void 0:r.y)&&void 0!==l?l:0),u=e.line.line2MinLength,c=e.layout,b=e.spaceWidth;if(t.forEach((t=>{const e=gt(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+u+b),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===c.strategy){for(const i of t){const{labelPosition:t,labelSize:n}=i;i.labelLimit=n.width,i.pointB=gt(i.quadrant)?{x:t.x+n.width/2+u+b,y:t.y}:{x:t.x-n.width/2-u-b,y:t.y},this._computeX(i,e,s)}!1===e.coverEnable&&"none"===c.strategy&&this._coverLabels(t)}else{const i=h/((null===(o=e.textStyle)||void 0===o?void 0:o.fontSize)||16);this._adjustY(t,i,e,s);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(h,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),r=Math.max(Math.abs(h/2-n),Math.abs(a-h/2)),l=this._computeLayoutRadius(r,e,s);for(const i of t)this._computePointB(i,l,e,s),this._computeX(i,e,s)}const g=2*d;return t.forEach((t=>{var s,n;t.labelVisible&&(i.isLess(t.pointB.x,u+b)||i.isGreater(t.pointB.x,g-u-b))&&(t.labelVisible=!1),t.angle=null!==(n=null===(s=null==e?void 0:e.textStyle)||void 0===s?void 0:s.angle)&&void 0!==n?n:0,t.labelLine=Object.assign({},null==e?void 0:e.line)})),t}_computeX(t,e,s){var n;const a=t.circleCenter,r=2*a.x;a.y;let l=0;s.forEach((t=>{t.attribute.outerRadius>l&&(l=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(l,e.width,e.height),d=e.line.line1MinLength,h=e.line.line2MinLength,u=null===(n=e.layout)||void 0===n?void 0:n.align,c=e.spaceWidth,{labelPosition:b,quadrant:g,pointB:p}=t;i.isValidNumber(p.x*p.y)||(t.pointC={x:NaN,y:NaN},b.x=NaN,t.labelLimit=0);const v=this.computeRadius(o,e.width,e.height),m=gt(g)?-1:1;let _=0;let y=(m>0?r-p.x:p.x)-h-c;"labelLine"===u&&(_=(v+d+h)*m+a.x,y=(m>0?r-_:_)-c);const x=this._getFormatLabelText(t.refDatum,y);t.labelText=x;let f=Math.min(y,t.labelSize.width);switch(u){case"labelLine":break;case"edge":_=m>0?r-f-c:f+c;break;default:_=p.x+m*h}f=Math.max(this._ellipsisWidth,f),t.labelLimit=f,t.pointC={x:_,y:b.y};const A=.5*(t.labelLimit<t.labelSize.width?t.labelLimit:t.labelSize.width);if("edge"===u){const t=0;b.x=(m>0?r+t:t)-m*A}else{const t=0;b.x=_+t+m*(c+A)}}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_computeAlign(t,e){var s,n,a,r,l,o;const d=e,h=null!==(n=null===(s=d.textStyle)||void 0===s?void 0:s.textAlign)&&void 0!==n?n:null===(a=d.textStyle)||void 0===a?void 0:a.align,u=null!==(l=null===(r=d.layout)||void 0===r?void 0:r.textAlign)&&void 0!==l?l:null===(o=d.layout)||void 0===o?void 0:o.align;return"inside"!==d.position?i.isNil(h)||"auto"===h?"edge"===u?gt(t.quadrant)?"left":"right":gt(t.quadrant)?"right":"left":h:i.isNil(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){return t.text}_adjustY(t,e,s,n){var a,r,l,o;r=null===(a=n[0].attribute)||void 0===a?void 0:a.x;const d=2*(null!==(o=null===(l=n[0].attribute)||void 0===l?void 0:l.y)&&void 0!==o?o:0),h=s.layout;if("vertical"===h.strategy){let e,s=0;const n=t.length;if(n<=0)return;for(let a=0;a<n;a++){const{y1:r}=t[a].getLabelBounds();if(e=r-s,i.isLess(e,0)){const i=this._shiftY(t,a,n-1,-e);this._shiftY(t,i,0,e/2)}const{y2:l}=t[a].getLabelBounds();s=l}const{y1:a}=t[0].getLabelBounds();e=a-0,i.isLess(e,0)&&this._shiftY(t,0,n-1,-e);for(let e=t.length-1;e>=0&&t[e].getLabelBounds().y2>d;e--)t[e].labelVisible=!1}else if("none"!==h.strategy){const a=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));a.sort(((t,e)=>e.arc.radian-t.arc.radian)),a.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,l=-1/0;for(let o=0;o<e&&o<t.length;o++){this._storeY(t);const e=a[o].arc;this._computeYRange(e,s,n),e.labelVisible=!0;const u=e.labelPosition.y,{lastIndex:c,nextIndex:b}=this._findNeighborIndex(t,a[o]),g=t[c],p=t[b];if(-1===c&&-1!==b){const i=p.labelPosition.y;u>i?e.labelPosition.y=i-p.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,p,b)}else if(-1!==c&&-1===b){const i=g.labelPosition.y;u<i?e.labelPosition.y=i+g.labelSize.height/2+e.labelSize.height/2:this._twoWayShift(t,g,e,a[o].originIndex)}else if(-1!==c&&-1!==b){const i=g.labelPosition.y,s=p.labelPosition.y;u>s?(e.labelPosition.y=s-p.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,g,e,a[o].originIndex)):u<i?(e.labelPosition.y=i+g.labelSize.height/2+e.labelSize.height/2,this._twoWayShift(t,e,p,b)):(this._twoWayShift(t,g,e,a[o].originIndex),this._twoWayShift(t,e,p,b))}const v=Math.min(r,a[o].originIndex),m=Math.max(l,a[o].originIndex);let _;if(_=t[m].getLabelBounds().y2-d,i.isGreater(_,0)&&this._shiftY(t,m,0,-_),_=t[v].getLabelBounds().y1-0,i.isLess(_,0)&&this._shiftY(t,v,t.length-1,-_),_=t[m].getLabelBounds().y2-d,i.isGreater(_,0)){e.labelVisible=!1,this._restoreY(t);break}h.tangentConstraint&&!this._checkYRange(t)?(e.labelVisible=!1,this._restoreY(t)):(r=v,l=m)}}}_shiftY(t,e,i,s){const n=e<i?1:-1;let a=e;for(;-1!==a;){t[a].labelPosition.y+=s;const e=this._findNextVisibleIndex(t,a,i,n);if(e>=0&&e<t.length){const{y1:i,y2:s}=t[a].getLabelBounds(),{y1:r,y2:l}=t[e].getLabelBounds();if(n>0&&s<r||n<0&&i>l)return a}a=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,s,n){const a=s;let r=0;n.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const l=this.computeLayoutOuterRadius(r,s.width,s.height),o=a.line.line1MinLength;if("none"===a.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const n=t.circleCenter,a=this.computeRadius(l,s.width,s.height),{labelPosition:r,quadrant:d}=t,h=e-Math.max(a+o,t.outerRadius),u=Math.sqrt(e**2-Math.abs(n.y-r.y)**2)-h;i.isValidNumber(u)?t.pointB={x:n.x+u*(gt(d)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,s){const n=t.circleCenter,a={width:2*n.x,height:2*n.y};let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const l=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:d,height:h}=a,u=this.computeRadius(l,e.width,e.height),c=this._computeLayoutRadius(h/2,e,s),b=Math.abs(t.center.x-d/2),g=t.center.y-h/2;let p,v,m;if(i.isNumberClose(d/2,b))p=0,v=1,m=-g;else if(i.isNumberClose(h/2,g))p=1,v=0,m=-b;else{const t=-1/(g/b);p=t,v=-1,m=g-t*b}const _=function(t,e,i,s,n,a){if(0===t&&0===e||a<=0)return[];if(0===t){const t=-i/e,r=a**2-(t-n)**2;return r<0?[]:0===r?[{x:s,y:t}]:[{x:Math.sqrt(r)+s,y:t},{x:-Math.sqrt(r)+s,y:t}]}if(0===e){const e=-i/t,r=a**2-(e-s)**2;return r<0?[]:0===r?[{x:e,y:n}]:[{x:e,y:Math.sqrt(r)+n},{x:e,y:-Math.sqrt(r)+n}]}const r=(e/t)**2+1,l=2*((i/t+s)*(e/t)-n),o=l**2-4*r*((i/t+s)**2+n**2-a**2);if(o<0)return[];const d=(-l+Math.sqrt(o))/(2*r),h=(-l-Math.sqrt(o))/(2*r),u=-(e*d+i)/t;return 0===o?[{x:u,y:d}]:[{x:u,y:d},{x:-(e*h+i)/t,y:h}]}(p,v,m,o+u-c,0,c);if(_.length<2)return;let y,x;_[0].x>_[1].x&&_.reverse(),_[0].x<0?i.isNumberClose(_[0].y,_[1].y)?Math.abs(t.middleAngle)<Math.PI/2?(y=0,x=_[1].y+h/2):(y=_[1].y+h/2,x=h):_[0].y<_[1].y?(y=0,x=_[1].y+h/2):(y=_[1].y+h/2,x=a.height):(y=Math.min(_[0].y,_[1].y)+h/2,x=Math.max(_[0].y,_[1].y)+h/2),t.labelYRange=[y,x]}_computeLayoutRadius(t,e,i){const s=e,n=s.layoutArcGap,a=s.line.line1MinLength;let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const l=this.computeLayoutOuterRadius(r,e.width,e.height),o=this.computeRadius(l,e.width,e.height)+a,d=o-n;return Math.max((d**2+t**2)/(2*d),o)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e<t.length;e++)if(t[e].labelVisible){n=e;break}return{lastIndex:s,nextIndex:n}}_twoWayShift(t,e,s,n){const a=s.getLabelBounds().y1-e.getLabelBounds().y2;if(i.isLess(a,0)){const e=this._shiftY(t,n,t.length-1,-a);this._shiftY(t,e,0,a/2)}}_restoreY(t){for(const e of t)e.labelVisible&&(e.labelPosition.y=e.lastLabelY)}_checkYRange(t){for(const e of t){const{labelYRange:t,labelPosition:s}=e;if(e.labelVisible&&t&&(i.isLess(s.y,t[0])||i.isGreater(s.y,t[1])))return!1}return!0}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i<t.length;i++){const s=t[i].getLabelBounds();pt(e,s)?t[i].labelVisible=!1:e=s}}_labelLine(t){var i,s,n,a,r,l,o,d,h,u,c,b,g,p,v,m,_,y,x;return(null===(i=t.attribute)||void 0===i?void 0:i.points)?e.createLine({visible:null===(o=null!==(r=(null===(n=null===(s=t.attribute)||void 0===s?void 0:s.line)||void 0===n?void 0:n.visible)&&(null===(a=t.attribute)||void 0===a?void 0:a.visible))&&void 0!==r?r:null===(l=t.attribute)||void 0===l?void 0:l.visible)||void 0===o||o,stroke:null!==(c=null===(u=null===(h=null===(d=t.attribute)||void 0===d?void 0:d.line)||void 0===h?void 0:h.style)||void 0===u?void 0:u.stroke)&&void 0!==c?c:null===(b=t.attribute)||void 0===b?void 0:b.fill,lineWidth:null!==(m=null===(v=null===(p=null===(g=t.attribute)||void 0===g?void 0:g.line)||void 0===p?void 0:p.style)||void 0===v?void 0:v.lineWidth)&&void 0!==m?m:1,points:null===(_=t.attribute)||void 0===_?void 0:_.points,curveType:(null===(x=null===(y=t.attribute)||void 0===y?void 0:y.line)||void 0===x?void 0:x.smooth)?"basis":null}):void 0}computeRadius(t,e,s,n){return this.computeLayoutRadius(e||0,s||0)*t*(i.isNil(n)?1:n)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return"inside"===this.attribute.position}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){const s=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*s}}mt.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,textAlign:"center",textBaseline:"middle"},position:"outside",offset:0,line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0},pickable:!1};const _t={rect:ht,symbol:dt,arc:mt};class yt extends a{constructor(t){super(i.merge({},yt.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:s=0,height:n=0}=e||{};if(!s||!n||!i.isValidNumber(n*s))return;this._componentMap||(this._componentMap=new Map);const a=q(s,n),r=a.bitmap(),l=new Map,o=this._componentMap;for(let e=0;e<t.length;e++){const i=t[e],s=_t[i.type]||ot;if(s){const{baseMarkGroupName:t}=i;let e=this._componentMap.get(t);e?(e.setBitmapTool(a),e.setBitmap(r),e.setAttributes(i),l.set(t,e)):(e=new s(i),e.setBitmap(r),e.setBitmapTool(a),this.add(e),l.set(t,e))}}o.forEach(((t,e)=>{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}yt.defaultAttributes={pickable:!1};class xt extends a{getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t){super(i.merge({},xt.defaultAttributes,t)),this.name="segment"}render(){this.removeAllChild(),this._reset();const{startSymbol:t,endSymbol:s,lineStyle:n,state:a,visible:r=!0,multiSegment:l,mainSegmentIndex:o}=this.attribute;if(!r)return;this._computeLineAngle();const d=this._renderSymbol(t,"start"),h=this._renderSymbol(s,"end");if(this.startSymbol=d,this.endSymbol=h,l){const t=[...this.attribute.points];if(i.isValidNumber(o))t[o]=this._clipPoints(t[o]);else{const e=this._clipPoints(i.flattenArray(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,s)=>{var r,l;const o=e.createLine(Object.assign(Object.assign({points:t},i.isArray(n)?null!==(r=n[s])&&void 0!==r?r:n[n.length-1]:n),{fill:!1}));o.name=`${this.name}-line`,o.id=this._getNodeId("line"+s),i.isEmpty(null==a?void 0:a.line)||(o.states=i.isArray(a.line)?null!==(l=a.line[s])&&void 0!==l?l:a.line[a.line.length-1]:a.line),this.add(o)}))}else{const t=e.createLine(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},i.array(n)[0]),{fill:!1}));t.name=`${this.name}-line`,t.id=this._getNodeId("line"),i.isEmpty(null==a?void 0:a.line)||(t.states=[].concat(a.line)[0]),this.add(t)}}_renderSymbol(t,s){const n=this._getMainSegmentPoints();if(!n.length)return;const{autoRotate:a=!0}=t;let r;if(null==t?void 0:t.visible){const l=this._startAngle,o=this._endAngle,{state:d}=this.attribute,h=n[0],u=n[n.length-1],{refX:c=0,refY:b=0,refAngle:g=0,style:p,symbolType:v,size:m=12}=t;let _,y;"start"===s?(_={x:h.x+(i.isValidNumber(l)?c*Math.cos(l)+b*Math.cos(l-Math.PI/2):0),y:h.y+(i.isValidNumber(l)?c*Math.sin(l)+b*Math.sin(l-Math.PI/2):0)},y=l+Math.PI/2):(_={x:u.x+(i.isValidNumber(o)?c*Math.cos(o)+b*Math.cos(o-Math.PI/2):0),y:u.y+(i.isValidNumber(o)?c*Math.sin(o)+b*Math.sin(o-Math.PI/2):0)},y=o+Math.PI/2),r=e.createSymbol(Object.assign(Object.assign(Object.assign({},_),{symbolType:v,size:m,angle:a?y+g:0,strokeBoundsBuffer:0}),p)),r.name=`${this.name}-${s}-symbol`,r.id=this._getNodeId(`${s}-symbol`),i.isEmpty(null==d?void 0:d.symbol)||(r.states=d.symbol),this.add(r)}return r}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:s}=this.attribute;let n;return n=e?i.isValidNumber(s)?t[s]:i.flattenArray(t):t,this._mainSegmentPoints=n,n}_clipPoints(t){const{startSymbol:e,endSymbol:i}=this.attribute;let s=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0:i.size)||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],a=[e.x-i.x,e.y-i.y],r=Math.atan2(a[1],a[0]),l=[n.x-s.x,n.y-s.y],o=Math.atan2(l[1],l[0]);this._startAngle=r,this._endAngle=o}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}var ft,At;xt.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},t.AXIS_ELEMENT_NAME=void 0,(ft=t.AXIS_ELEMENT_NAME||(t.AXIS_ELEMENT_NAME={})).innerView="inner-view",ft.axisContainer="axis-container",ft.labelContainer="axis-label-container",ft.tickContainer="axis-tick-container",ft.tick="axis-tick",ft.subTick="axis-sub-tick",ft.label="axis-label",ft.title="axis-title",ft.gridContainer="axis-grid-container",ft.grid="axis-grid",ft.gridRegion="axis-grid-region",ft.line="axis-line",ft.background="axis-background",ft.axisLabelBackground="axis-label-background",t.AxisStateValue=void 0,(At=t.AxisStateValue||(t.AxisStateValue={})).selected="selected",At.selectedReverse="selected_reverse",At.hover="hover",At.hoverReverse="hover_reverse";const St={[t.AxisStateValue.selectedReverse]:{},[t.AxisStateValue.selected]:{},[t.AxisStateValue.hover]:{},[t.AxisStateValue.hoverReverse]:{}},Et={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}};class Lt extends a{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{const e=t.target;e!==this._lastHover&&e.name&&!i.isEmpty(e.states)&&(e.addState(L.hover,!0),u(this.axisContainer,(t=>{t!==e&&t.name&&!i.isEmpty(t.states)&&t.addState(L.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(u(this.axisContainer,(t=>{t.name&&!i.isEmpty(t.states)&&(t.removeState(L.hoverReverse),t.removeState(L.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(L.selected))return this._lastSelect=null,void u(this.axisContainer,(t=>{t.name&&!i.isEmpty(t.states)&&(t.removeState(L.selectedReverse),t.removeState(L.selected))}));e.name&&!i.isEmpty(e.states)&&(e.addState(L.selected,!0),u(this.axisContainer,(t=>{t!==e&&t.name&&!i.isEmpty(t.states)&&t.addState(L.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const s=i.cloneDeep(this.attribute);i.merge(this.attribute,t);const n=e.createGroup({x:this.attribute.x,y:this.attribute.y});return this.add(n),this._renderInner(n),this.removeChild(n),this.attribute=s,n.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=e.createGroup({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(i){const{title:s,label:n,tick:a,line:r,items:l}=this.attribute,o=e.createGroup({x:0,y:0,zIndex:1});if(o.name=t.AXIS_ELEMENT_NAME.axisContainer,o.id=this._getNodeId("container"),o.setMode(this.mode),this.axisContainer=o,i.add(o),(null==r?void 0:r.visible)&&this.renderLine(o),l&&l.length&&(this.data=this._transformItems(l[0]),(null==a?void 0:a.visible)&&this.renderTicks(o),null==n?void 0:n.visible)){const i=e.createGroup({x:0,y:0,pickable:!1});i.name=t.AXIS_ELEMENT_NAME.labelContainer,i.id=this._getNodeId("label-container"),this.axisLabelsContainer=i,o.add(i),l.forEach(((t,e)=>{const s=this.renderLabels(i,t,e),n=s.getChildren();this.beforeLabelsOverlap(n,t,s,e,l.length),this.handleLabelsOverlap(n,t,s,e,l.length),this.afterLabelsOverlap(n,t,s,e,l.length)}))}(null==s?void 0:s.visible)&&this.renderTitle(o)}renderTicks(s){const n=this.getTickLineItems(),a=e.createGroup({x:0,y:0,pickable:!1});a.name=t.AXIS_ELEMENT_NAME.tickContainer,a.id=this._getNodeId("tick-container"),s.add(a),n.forEach(((s,r)=>{var l;const o=e.createLine(Object.assign({},this._getTickLineAttribute("tick",s,r,n)));if(o.name=t.AXIS_ELEMENT_NAME.tick,o.id=this._getNodeId(s.id),i.isEmpty(null===(l=this.attribute.tick)||void 0===l?void 0:l.state))o.states=k;else{const t=this.data[r],e=i.merge({},k,this.attribute.tick.state);Object.keys(e).forEach((s=>{i.isFunction(e[s])&&(e[s]=e[s](t.rawValue,r,t,this.data))})),o.states=e}a.add(o)})),this.tickLineItems=n;const{subTick:r}=this.attribute;if(null==r?void 0:r.visible){const s=this.getSubTickLineItems();s.length&&s.forEach(((s,l)=>{const o=e.createLine(Object.assign({},this._getTickLineAttribute("subTick",s,l,n)));if(o.name=t.AXIS_ELEMENT_NAME.subTick,o.id=this._getNodeId(`${l}`),i.isEmpty(r.state))o.states=k;else{const t=i.merge({},k,r.state);Object.keys(t).forEach((e=>{i.isFunction(t[e])&&(t[e]=t[e](s.value,l,s,n))})),o.states=t}a.add(o)})),this.subTickLineItems=s}}renderLabels(s,n,a){const{dataFilter:r}=this.attribute.label;r&&i.isFunction(r)&&(n=r(n,a));const l=this._transformItems(n),o=e.createGroup({x:0,y:0,pickable:!1});o.name=`${t.AXIS_ELEMENT_NAME.labelContainer}-layer-${a}`,o.id=this._getNodeId(`label-container-layer-${a}`),s.add(o);let d=0,h=0,u="center",c="middle";return l.forEach(((s,n)=>{var r,b;const g=this._getLabelAttribute(s,n,l,a),p=e.createText(g);if(p.name=t.AXIS_ELEMENT_NAME.label,p.id=this._getNodeId(`layer${a}-label-${s.id}`),i.isEmpty(null===(r=this.attribute.label)||void 0===r?void 0:r.state))p.states=k;else{const t=i.merge({},k,this.attribute.label.state);Object.keys(t).forEach((e=>{i.isFunction(t[e])&&(t[e]=t[e](s,n,l,a))})),p.states=t}o.add(p);const v=null!==(b=g.angle)&&void 0!==b?b:0;d=Math.max(d,p.AABBBounds.width()),h=Math.max(h,p.AABBBounds.height()),v&&(d=Math.abs(d*Math.cos(v)),h=Math.abs(h*Math.sin(v))),u=g.textAlign,c=g.textBaseline})),this.axisLabelLayerSize[a]={width:d,height:h,textAlign:u,textBaseline:c},o}renderTitle(e){const i=this.getTitleAttribute(),s=new w(Object.assign({},i));s.name=t.AXIS_ELEMENT_NAME.title,s.id=this._getNodeId("title"),e.add(s)}getVerticalCoord(t,e,i){const s=this.getVerticalVector(e,i,t);return{x:t.x+s[0],y:t.y+s[1]}}getTextAlign(t){let e="center";return i.isNumberClose(t[0],0)?i.isNumberClose(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,s=[],{alignWithLabel:n,inside:a=!1,length:r,dataFilter:l}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(l&&i.isFunction(l)?l(e):e).forEach((t=>{let e=t.point,l=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),l=i}const d=this.getVerticalCoord(e,r,a);if("3d"===this.mode){const n=this.getVerticalVector(r,a,e);let o=0,h=0;i.abs(n[0])>i.abs(n[1])?o=i.pi/2*(d.x>e.x?1:-1):h=i.pi/2*(d.y>e.y?-1:1),s.push({start:e,end:d,value:l,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else s.push({start:e,end:d,value:l,id:`tick-${t.id}`})})),s}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,a=this.tickLineItems,r=a.length;if(r>=2)for(let t=0;t<r-1;t++){const r=a[t],l=a[t+1];for(let t=0;t<i;t++){const a=(t+1)/(i+1),o=(1-a)*r.value+a*l.value,d=this.getTickCoord(o),h=this.getVerticalCoord(d,n,s);e.push({start:d,end:h,value:o,id:`sub-tick-${o}`})}}return e}_getTickLineAttribute(t,e,s,n){let a=i.get(this.attribute,`${t}.style`);const r=this.data[s];a=i.isFunction(a)?i.merge({},i.get(Et,`${t}.style`),"tick"===t?a(r.rawValue,s,r,this.data):a(e.value,s,e,n)):a;const{start:l,end:o,anchor:d,alpha:h,beta:u}=e;return Object.assign({points:[l,o],anchor:d,alpha:h,beta:u},a)}_getLabelAttribute(t,e,s,n){var a,r,l,d,h,u;const c=this.attribute.label,{space:b=4,inside:g=!1,formatMethod:p}=c,v=o(c,["space","inside","formatMethod"]);let m=b,_=0;(null===(a=this.attribute.tick)||void 0===a?void 0:a.visible)&&(null===(r=this.attribute.tick)||void 0===r?void 0:r.inside)===g&&(_=(null===(l=this.attribute.tick)||void 0===l?void 0:l.length)||4),(null===(d=this.attribute.subTick)||void 0===d?void 0:d.visible)&&(null===(h=this.attribute.subTick)||void 0===h?void 0:h.inside)===g&&(_=Math.max(_,(null===(u=this.attribute.subTick)||void 0===u?void 0:u.length)||2)),m+=_;const y=this.getRelativeVector(t.point);n>0&&(0===y[1]?m+=(this.axisLabelLayerSize[n-1].height+i.get(this.attribute,"label.space",4))*n:m+=(this.axisLabelLayerSize[n-1].width+i.get(this.attribute,"label.space",4))*n);const x=this.getVerticalCoord(t.point,m,g),f=this.getVerticalVector(m,g,x),A=p?p(`${t.label}`,t,e,s,n):t.label;let{style:S}=v;S=i.isFunction(S)?i.merge({},Et.label.style,S(t,e,s,n)):S;const E=this.getLabelAlign(f,g,S.angle);return S=i.merge(E,S),i.isFunction(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},x),{text:A,lineHeight:null==S?void 0:S.fontSize}),S)}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}}const kt={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&Mt(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Mt(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function Bt(t,e){for(let i,s=1,n=t.length,a=t[0].AABBBounds;s<n;a=i,++s)if(Mt(a,i=t[s].AABBBounds,e))return!0}function wt(t){const e=t.AABBBounds;return e.width()>1&&e.height()>1}function Tt(t){for(let n=1;n<t.length;n++)if(e=t[n-1],s=t[n],i.isRotateAABBIntersect(e.rotatedBounds,s.rotatedBounds,!0))return!0;var e,s;return!1}function Ct(t,e){"bottom"!==t&&"top"!==t||function(t,e){e.forEach((e=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Ot(t,e.attribute.angle)),{angle:Pt(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},It(t,e.attribute.angle)),{angle:Pt(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(s=e.centerX,n=e.centerY,a=e.angle,r=t.attribute.x,l=t.attribute.y,{x:(s-r)*Math.cos(a)+(n-l)*Math.sin(a)+r,y:(s-r)*Math.sin(a)+(l-n)*Math.cos(a)+l});var s,n,a,r,l;const o=i.x-e.centerX,d=i.y-e.centerY;e.x1+=o,e.x2+=o,e.y1+=d,e.y2+=d,e.centerX+=o,e.centerY+=d,t.rotatedBounds=e}))}(e)}function Pt(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Ot(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Pt(e))/(.5*Math.PI);let a;return a=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[a],textBaseline:s[a]}}function It(t,e=0){let i=["right","right","center","left","center","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],s=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Pt(e))/(.5*Math.PI);let a;return a=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[a],textBaseline:s[a]}}class Ht{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){const[e,i]=t;let s=e*e+i*i;return s>0&&(s=1/Math.sqrt(s)),[t[0]*s,t[1]*s]}(this.getRelativeVector());return x([n[1],-1*n[0]],t*(e?1:-1)*s)}}class Vt extends Lt{constructor(t,e){super(i.merge({},Vt.defaultAttributes,t),e),"3d"===e&&this.setMode(e)}_renderInner(s){var n;super._renderInner(s);const{panel:a}=this.attribute;if(a&&a.visible){const s=this.axisContainer,r=s.AABBBounds,l=e.createRect(Object.assign({x:r.x1,y:r.y1,width:r.width(),height:r.height()},a.style));l.name=t.AXIS_ELEMENT_NAME.background,l.id=this._getNodeId("background"),l.states=i.merge({},St,null!==(n=a.state)&&void 0!==n?n:{}),s.insertBefore(l,s.firstChild)}}renderLine(e){const{start:s,end:n,line:a}=this.attribute,r=a,{startSymbol:l,endSymbol:d,style:h,breakRange:u,breakShape:c,breakShapeStyle:b,state:g}=r,p=o(r,["startSymbol","endSymbol","style","breakRange","breakShape","breakShapeStyle","state"]),v=Object.assign({points:[s,n],startSymbol:l,endSymbol:d,lineStyle:h},p);i.isEmpty(g)||(v.state={line:i.merge({},St,g),symbol:i.merge({},St,g)});const m=new xt(v);m.name=t.AXIS_ELEMENT_NAME.line,m.id=this._getNodeId("line"),e.add(m)}getTitleAttribute(){var t,e,s,n,a,r,l,d;const h=this.attribute.title,{position:u="middle",space:c=4,textStyle:b={},autoRotate:g=!0,shape:p,background:v,state:m}=h,_=o(h,["position","space","textStyle","autoRotate","shape","background","state"]);let y=.5;"start"===u?y=0:"end"===u&&(y=1);const{verticalFactor:x=1}=this.attribute,A=-1*x,S=this.getTickCoord(y),E=this.getRelativeVector();let L=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+i.get(this.attribute,"label.space",4);L+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===E[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?L+=i+(e-1)*t:L=0}else{if(0===E[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?L+=i+(e-1)*t:L=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{L+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,n="center"===i,a=E[1]>0;L=1===A?a?s?L:n?L/2:t:s?t:n?L/2:L:a?s?t:n?L/2:L:s?L:n?L/2:t}}let k=0;(null===(s=this.attribute.tick)||void 0===s?void 0:s.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(k=(null===(a=this.attribute.tick)||void 0===a?void 0:a.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(l=this.attribute.subTick)||void 0===l?void 0:l.inside)&&(k=Math.max(k,(null===(d=this.attribute.subTick)||void 0===d?void 0:d.length)||2));const M=k+L+c,B=this.getVerticalCoord(S,M,!1),w=this.getVerticalVector(M,!1,{x:0,y:0});let T,C,{angle:P}=_;if(T="start"===u?"start":"end"===u?"end":"center",i.isNil(P)&&g){P=f(E,[1,0],!0);const{verticalFactor:t=1}=this.attribute;C=1===-1*t?"bottom":"top"}else T=this.getTextAlign(w),C=this.getTextBaseline(w,!1);const O=Object.assign(Object.assign(Object.assign({},B),_),{textStyle:Object.assign({textAlign:T,textBaseline:C},b),state:{text:i.merge({},St,null==m?void 0:m.text),shape:i.merge({},St,null==m?void 0:m.shape),panel:i.merge({},St,null==m?void 0:m.background)}});return O.angle=P,p&&p.visible&&(O.shape=Object.assign({visible:!0},p.style),p.space&&(O.space=p.space)),v&&v.visible&&(O.panel=Object.assign({visible:!0},v.style)),O}getTextBaseline(t,e){let s="middle";const{verticalFactor:n=1}=this.attribute,a=(e?1:-1)*n;return i.isNumberClose(t[1],0)?s=!i.isNumberClose(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===a?"bottom":"top":t[1]>0?s="top":t[1]<0&&(s="bottom"),s}getLabelAlign(t,e,s){const n=this.attribute.orient;if(i.isValidNumber(s)){if("top"===n||"bottom"===n)return Ot(n,s);if("left"===n||"right"===n)return It(n,s)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,s,n,a){const{flush:r=!1}=this.attribute.label||{};if(r&&t.length){const{orient:e,start:s,end:n}=this.attribute,a="bottom"===e||"top"===e,r=t[0],l=i.last(t),o=a?r.attribute.x>l.attribute.x:r.attribute.y<l.attribute.y;if(a){const t=Math.abs(s.x-n.x);if(o){const e=t,i=0,s=r.AABBBounds.x2,n=l.AABBBounds.x1;s>e&&r.setAttributes({x:e,textAlign:"right"}),n<i&&l.setAttributes({x:i,textAlign:"left"})}else{const e=0,i=t,s=r.AABBBounds.x1,n=l.AABBBounds.x2;s<e&&r.setAttributes({x:e,textAlign:"left"}),n>i&&l.setAttributes({x:i,textAlign:"right"})}}else{const t=Math.abs(s.y-n.y);if(o){const e=r.AABBBounds.y1,i=l.AABBBounds.y2,s=0,n=t;e<s&&r.setAttributes({y:s,textBaseline:"top"}),i>n&&l.setAttributes({y:n,textBaseline:"bottom"})}else{const e=t,i=0,s=r.AABBBounds.y2,n=l.AABBBounds.y1;s>e&&r.setAttributes({y:e,textBaseline:"bottom"}),n<i&&l.setAttributes({y:i,textBaseline:"top"})}}}}handleLabelsOverlap(t,e,s,n,a){if(i.isEmpty(t))return;const{verticalLimitSize:r,label:l,orient:o}=this.attribute,d=this._getAxisLabelLimitLength(r,a),{layoutFunc:h,autoRotate:u,autoRotateAngle:c,autoLimit:b,limitEllipsis:g,autoHide:p,autoHideMethod:v,autoHideSeparation:m}=l;i.isFunction(h)?h(t,e,n,this):(u&&function(t,e){if(i.isEmpty(t))return;const{orient:s,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let a=0,r=0;for(n&&n.length>0&&(r=n.length);a<r;){const e=n[a++];if(t.forEach((t=>{t.attribute.angle=i.degreeToRadian(e)})),Ct(s,t),!Tt(t))break}}(t,{labelRotateAngle:c,orient:o}),b&&i.isValidNumber(d)&&d>0&&function(t,e){const{limitLength:s,ellipsis:n="...",orient:a}=e;!i.isEmpty(t)&&i.isValidNumber(s)&&t.forEach((t=>{if(("top"===a||"bottom"===a)&&Math.floor(t.AABBBounds.height())<=s)return;if(("left"===a||"right"===a)&&Math.floor(t.AABBBounds.width())<=s)return;let e=0===t.attribute.angle||i.isNil(t.attribute.angle)?"top"===a||"bottom"===a?null:s:Math.abs(s/Math.sin(t.attribute.angle));i.isValidNumber(t.attribute.maxLineWidth)&&(e=i.isValidNumber(e)?Math.min(t.attribute.maxLineWidth,e):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:e,ellipsis:t.attribute.ellipsis||n})}))}(t,{limitLength:d,ellipsis:g,orient:o}),p&&function(t,e){if(i.isEmpty(t))return;const s=t.filter(wt);if(i.isEmpty(s))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(s);const{method:a="parity",separation:r=0}=e,l=i.isFunction(a)?a:kt[a]||kt.parity;if(n.length>=3&&Bt(n,r)){do{n=l(n,r)}while(n.length>=3&&Bt(n,r));n.length<3&&!i.last(s).attribute.opacity&&(n.length>1&&i.last(n).setAttribute("opacity",0),i.last(s).setAttribute("opacity",1))}s.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:v,separation:m}))}afterLabelsOverlap(s,n,a,r,l){const{verticalLimitSize:o,orient:d}=this.attribute,h="bottom"===d||"top"===d,u=a.AABBBounds;let c=h?u.height():u.width();const{verticalMinSize:b}=this.attribute;if(i.isValidNumber(b)&&(!i.isValidNumber(o)||b<=o)){const i=this._getAxisLabelLimitLength(b,l);let s,n;c=Math.max(c,i),"left"===d?(s=u.x2-c,n=u.y1):"right"===d?(s=u.x1,n=u.y1):"top"===d?(s=u.x1,n=u.y2-c):"bottom"===d&&(s=u.x1,n=u.y1);const r=e.createRect({x:s,y:n,width:h?u.width():c,height:h?c:u.height(),pickable:!1});r.name=t.AXIS_ELEMENT_NAME.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),a.insertBefore(r,a.firstChild)}if(i.isValid(this.attribute.label.containerAlign)){let t;"left"===d?t=u.x2:"right"===d?t=u.x1:"top"===d?t=u.y2:"bottom"===d&&(t=u.y1),function(t,e,i,s,n){if("right"===s||"left"===s){if("left"===n){const n="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"left"})}))}else if("right"===n){const n="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"right"})}))}else if("center"===n){const n="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===n){const n="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})}))}else if("bottom"===n){const n="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})}))}else if("middle"===n){const n="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})}))}}(s,t,c,d,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var s,n,a;const{label:r,title:l,line:o,tick:d}=this.attribute,h=null!==(s=r.space)&&void 0!==s?s:4;let u=t,c=0,b=0;const g=(null==o?void 0:o.visible)?null!==(n=o.style.lineWidth)&&void 0!==n?n:1:0,p=(null==d?void 0:d.visible)?null!==(a=d.length)&&void 0!==a?a:4:0;if(null==l?void 0:l.visible){c=B(l.text,l.textStyle).height;const t=i.normalizePadding(l.padding);b=l.space+t[0]+t[2]}return u&&(u=(u-h-b-c-g-p)/e),u}}Vt.defaultAttributes=Et,i.mixin(Vt,Ht);class zt{isInValidValue(t){const{startAngle:e=A,endAngle:i=S}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=A,endAngle:s=S,center:n,radius:a,inside:r=!1,innerRadius:l=0}=this.attribute,o=e+(s-e)*t;return i.polarToCartesian(n,r&&l>0?l:a,o)}getVerticalVector(t,e=!1,i){const{inside:s=!1}=this.attribute,{center:n}=this.attribute,a=[i.x-n.x,i.y-n.y];return x(a,(e?-1:1)*(s?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(a))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}class jt extends Lt{constructor(t){super(i.merge({},jt.defaultAttributes,t))}renderLine(s){const{startAngle:n=A,endAngle:a=S,radius:r,center:l,innerRadius:o=0,line:d,inside:h=!1}=this.attribute;let u=r,c=o;h&&o>0&&(u=o,c=0);const b=Object.assign(Object.assign(Object.assign({},l),{startAngle:n,endAngle:a,radius:u,innerRadius:c}),null==d?void 0:d.style),g=e.createCircle(b);g.name=t.AXIS_ELEMENT_NAME.line,g.id=this._getNodeId("line"),i.isEmpty(null==d?void 0:d.state)||(g.states=i.merge({},St,d.state)),s.add(g)}getTitleAttribute(){var t,e,s,n,a,r,l,d;const{center:h,radius:u,innerRadius:c=0}=this.attribute,b=this.attribute.title,{space:g=4,textStyle:p={},shape:v,background:m,state:_}=b,y=o(b,["space","textStyle","shape","background","state"]);let x=h,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(f=i.get(this.attribute.label,"style.fontSize",12)+i.get(this.attribute.label,"space",4));let A=0;(null===(s=this.attribute.tick)||void 0===s?void 0:s.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(a=this.attribute.tick)||void 0===a?void 0:a.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(l=this.attribute.subTick)||void 0===l?void 0:l.inside)&&(A=Math.max(A,(null===(d=this.attribute.subTick)||void 0===d?void 0:d.length)||2));const S=u+A+f+g;let E="middle",{position:L}=this.attribute.title;i.isNil(L)&&(L=0===c?"end":"middle"),"start"===L?(E="bottom",x={x:h.x,y:h.y-S}):"end"===L&&(E="top",x={x:h.x,y:h.y+S});const k=Object.assign(Object.assign(Object.assign({},x),y),{textStyle:Object.assign({textBaseline:E,textAlign:"center"},p),state:{text:i.merge({},St,null==_?void 0:_.text),shape:i.merge({},St,null==_?void 0:_.shape),panel:i.merge({},St,null==_?void 0:_.background)}}),{angle:M}=y;return k.angle=M,v&&v.visible&&(k.shape=Object.assign({visible:!0},v.style),v.space&&(k.space=v.space)),m&&m.visible&&(k.panel=Object.assign({visible:!0},m.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:a=!1,length:r=2}=i,l=this.tickLineItems,o=l.length;if(o>=2){const i=this.data[1].value-this.data[0].value,d=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t<o;t++){const e=l[t],o=l[t+1];for(let t=0;t<n;t++){const l=(t+1)/(n+1),h=(1-l)*e.value+l*(o?o.value:d?1:e.value+i),u=this.getTickCoord(h),c=this.getVerticalCoord(u,r,a);s.push({start:u,end:c,value:h})}}}return s}getTextBaseline(t){let e="middle";return i.isNumberClose(t[1],0)?e="middle":t[1]>0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,s,n){}handleLabelsOverlap(t,e,i,s,n){}afterLabelsOverlap(t,e,i,s,n){}getLabelAlign(t,e,i){return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t)}}}jt.defaultAttributes=Et,i.mixin(jt,zt);class Rt extends e.ACustomAnimate{constructor(){super(...arguments),this.mode=e.AnimateMode.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return u(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},u(t,(t=>{var e,s,n,a,r,l;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!i.isEqual(t.attribute,o.attribute)){const a=i.cloneDeep(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},a),{opacity:null!==(e=a.opacity)&&void 0!==e?e:1,fillOpacity:null!==(s=a.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=a.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(a=t.attribute.opacity)&&void 0!==a?a:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(l=t.attribute.strokeOpacity)&&void 0!==l?l:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((s=>{var n,a,r,l,o,d,h;const{node:u,attrs:c,state:b}=this._newElementAttrMap[s];"enter"===b&&(t=i.isValidNumber(null===(a=null===(n=this.params)||void 0===n?void 0:n.enter)||void 0===a?void 0:a.duration)?null===(r=this.params)||void 0===r?void 0:r.enter.duration:t,e=(null===(o=null===(l=this.params)||void 0===l?void 0:l.enter)||void 0===o?void 0:o.easing)?null===(h=null===(d=this.params)||void 0===d?void 0:d.enter)||void 0===h?void 0:h.easing:e),"path"===u.type?u.animate({interpolate:(t,e,s,n,a)=>"path"===t&&(a.path=i.interpolateString(s,n)(e),!0)}).to(c,t,e):u.animate().to(c,t,e)}))}onUpdate(t,e,i){}}class Nt extends e.ACustomAnimate{constructor(t,e,i,s){super(null,null,i,s)}getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}}class Dt extends e.ACustomAnimate{constructor(t,e,i,s){super(null,null,i,s)}getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}function $t(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function Wt(t,e,s,n){let a="";if(!t||0===e.length)return a;const r=e[0],l=i.PointService.distancePP(t,r),o=s?0:1;return n?a+=`M${t.x},${t.y-l}A${l},${l},0,0,${o},${t.x},${t.y+l}A${l},${l},0,0,${o},${t.x},${t.y-l}Z`:e.forEach(((t,e)=>{0===e?a=`M${t.x},${t.y}`:a+=`A${l},${l},0,0,${o},${t.x},${t.y}`})),a}function Ut(t,e,s){const{type:n,closed:a}=s,r=e.slice(0).reverse();let l="",o="";if("line"===n&&s.smoothLink&&s.center){const e=t[0],n=r[0],d=s.center;l=$t(t,!!a),o=$t(r,!!a);const h=i.PointService.distancePP(n,d),u=i.PointService.distancePP(e,d);l+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${u},${u},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=s;l=Wt(e,t,!1,!!a),o=Wt(e,r,!0,!!a)}else"line"!==n&&"polygon"!==n||(l=$t(t,!!a),o=$t(r,!!a));return a?l+=o:(o="L"+o.substring(1),l+=o,l+="Z"),l}class Ft extends a{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=e.createGroup({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:i}=this.attribute;t&&t.length&&!1!==i&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){const s=this.getVerticalVector(e,i,t);return{x:t.x+s[0],y:t.y+s[1]}}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(s,n){const a=i.merge({},this.attribute,this.getGridAttribute(s)),{type:r,items:l,style:o,closed:d,alternateColor:h,depth:u=0}=a,c=s?`${t.AXIS_ELEMENT_NAME.grid}-sub`:`${t.AXIS_ELEMENT_NAME.grid}`;if(l.forEach(((t,s)=>{const{id:a,points:l}=t;let h="";if("line"===r||"polygon"===r)h=$t(l,!!d);else if("circle"===r){const{center:t}=this.attribute;h=Wt(t,l,!1,!!d)}const b=e.createPath(Object.assign({path:h,z:u},i.isFunction(o)?i.merge({},Ft.defaultAttributes.style,o(t,s)):o));b.name=`${c}-line`,b.id=this._getNodeId(`${c}-path-${a}`),n.add(b)})),u&&"line"===r&&l.forEach(((t,s)=>{const{id:a,points:r}=t,l=[];l.push(r[0]);const h=r[1].x-r[0].x,b=r[1].y-r[0].y,g=Math.sqrt(h*h+b*b),p=u/g;l.push({x:r[0].x+h*p,y:r[0].y+b*p});const v=$t(l,!!d),m=i.abs(l[0].x-l[1].x),_=i.abs(l[0].y-l[1].y),y=e.createPath(Object.assign({path:v,z:0,alpha:m>_?(r[1].x-r[0].x>0?-1:1)*i.pi/2:0,beta:m<_?-i.pi/2:0,anchor3d:m>_?[l[0].x,0]:[0,l[0].y]},i.isFunction(o)?i.merge({},Ft.defaultAttributes.style,o(t,s)):o));y.name=`${c}-line`,y.id=this._getNodeId(`${c}-path-${a}`),n.add(y)})),l.length>1&&h){const t=i.isArray(h)?h:[h,"transparent"],s=e=>t[e%t.length];for(let t=0;t<l.length-1;t++){const[i,r]=[l[t].points,l[t+1].points],o=Ut(i,r,a),d=e.createPath({path:o,fill:s(t)});d.name=`${c}-region`,d.id=this._getNodeId(`${c}-region-${t}`),n.add(d)}}}_getNodeId(t){return`${this.id}-${t}`}}Ft.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class Gt extends Ft{constructor(t,e){super(i.merge({},Ft.defaultAttributes,t),e),"3d"===e&&this.setMode(e)}_getGridPoint(t,e){let s;if("line"===t){const{length:t}=this.attribute;s=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n=6,startAngle:a=A,endAngle:r=S}=this.attribute;s=function(t,e,s,n,a){const r=[],l=a-n;for(let a=0;a<e;a++){const o=n+a*l/e;r.push(i.polarToCartesian(t,s,o))}return r}(t,n,i.PointService.distancePP(t,e),a,r)}return s}getGridAttribute(t){const{type:e,alignWithLabel:s=!0}=this.attribute;let n=1;let a;this.data.length>=2&&(n=this.data[1].value-this.data[0].value);let r=[];if(t){a=i.merge({},this.attribute,this.attribute.subGrid);const t=[],{count:l=4}=this.attribute.subGrid||{};if(this.data.length>=2){const i=[];this.data.forEach((t=>{let e=t.value;if(!s){const i=t.value-n/2;if(this.isInValidValue(i))return;e=i}i.push({value:e})}));for(let s=0;s<i.length-1;s++){const n=i[s],a=i[s+1];t.push({id:`sub-${s}-0`,points:this._getGridPoint(e,this.getTickCoord(n.value)),datum:{}});for(let i=0;i<l;i++){const r=(i+1)/(l+1),o=(1-r)*n.value+r*a.value,d=this.getTickCoord(o);t.push({id:`sub-${s}-${i+1}`,points:this._getGridPoint(e,d),datum:{}})}s===i.length-2&&t.push({id:`sub-${s}-${l+1}`,points:this._getGridPoint(e,this.getTickCoord(a.value)),datum:{}})}r=t}}else{a=this.attribute;const t=[];this.data.forEach((i=>{let{point:a}=i;if(!s){const t=i.value-n/2;if(this.isInValidValue(t))return;a=this.getTickCoord(t)}t.push({id:i.label,datum:i,points:this._getGridPoint(e,a)})})),r=t}return Object.assign(Object.assign({},a),{items:r})}}i.mixin(Gt,Ht);class Yt extends Ft{constructor(t){super(i.merge({},Ft.defaultAttributes,t))}getGridAttribute(t){let e,s=[];const n=this.attribute,{radius:a,innerRadius:r=0,startAngle:l=A,endAngle:d=S,center:h,subGrid:u}=n,c=o(n,["radius","innerRadius","startAngle","endAngle","center","subGrid"]),{alignWithLabel:b=!0}=c||{},g=a-r;let p=1;if(this.data.length>=2&&(p=this.data[1].value-this.data[0].value),t){e=i.merge({},c,u);const t=[],{count:n=4}=u||{},a=this.data.length;if(a>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!b){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i<a;i++){const s=e[i],a=e[i+1];t.push({id:`sub-${i}-0`,points:[this.getTickCoord(s.value),this.getVerticalCoord(this.getTickCoord(s.value),g,!0)],datum:{}});for(let e=0;e<n;e++){const r=(e+1)/(n+1),l=(1-r)*s.value+r*(a?a.value:b?1:s.value+p),o=this.getTickCoord(l),d=this.getVerticalCoord(o,g,!0);t.push({id:`sub-${i}-${e+1}`,points:[o,d],datum:{}})}}Math.abs(d-l)%(2*Math.PI)==0&&t.push(t[0]),s=t}}else{e=c;const t=[];let i;i=Math.abs(d-l)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,i.forEach((e=>{let{point:i}=e;if(!b){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,g,!0);t.push({id:e.id,points:[i,s],datum:e})})),s=t}return Object.assign(Object.assign({},e),{items:s,center:h,type:"line"})}}var Xt;i.mixin(Yt,zt),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(Xt||(Xt={}));class qt extends a{constructor(t){super(i.merge({},qt.defaultAttributes,t)),this.name="dataZoom",this._previewData=[],this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",max:0},this.state={start:0,end:1},this._statePointToData=t=>t,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=Xt.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=Xt.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=Xt.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=Xt.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=Xt.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:s}=this.attribute,n=this.eventPosToStagePos(t),{attPos:a,max:r}=this._layoutCache,l=(n[a]-this._activeCache.lastPos[a])/r;this._activeState&&(this._activeTag===Xt.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===Xt.startHandler?this.state.start+l>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+l,this._activeTag=Xt.endHandler):this.state.start=this.state.start+l:this._activeTag===Xt.endHandler&&(this.state.end+l<this.state.start?(this.state.end=this.state.start,this.state.start=this.state.end+l,this._activeTag=Xt.startHandler):this.state.end=this.state.end+l),this._activeCache.lastPos=n,s&&this.renderDragMask()),this.state.start=Math.min(Math.max(this.state.start,0),1),this.state.end=Math.min(Math.max(this.state.end,0),1),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))};const{start:e,end:s,size:n,orient:a,showDetail:r,position:l,previewData:o,previewCallbackX:d,previewCallbackY:h,previewCallbackX1:u,previewCallbackY1:c,updateStateCallback:b}=this.attribute,{width:g,height:p}=n;e&&(this.state.start=e),s&&(this.state.end=s),this._isHorizontal="top"===a||"bottom"===a,this._layoutCache.max=this._isHorizontal?g:p,this._layoutCache.attPos=this._isHorizontal?"x":"y",this._layoutCache.attSize=this._isHorizontal?"width":"height",this._activeCache.startPos=l,this._activeCache.lastPos=l,this._showText="auto"!==r&&r,o&&(this._previewData=o),i.isFunction(d)&&(this._previewCallbackX=d),i.isFunction(h)&&(this._previewCallbackY=h),i.isFunction(u)&&(this._previewCallbackX1=u),i.isFunction(c)&&(this._previewCallbackY1=c),i.isFunction(b)&&(this._updateStateCallback=b)}bindEvents(){const{showDetail:t,brushSelect:i}=this.attribute;this._startHandler&&this._startHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const s=i?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,s))),i&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),i&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,s))),"browser"===e.vglobal.env&&(e.vglobal.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),e.vglobal.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,s;const n=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==n?void 0:n.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==n?void 0:n.top)||0)-((null===(s=this.stage)||void 0===s?void 0:s.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:s}=this.attribute;if(this._activeState&&this._activeTag===Xt.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,a=t[i]-n[i],r=e[i]-n[i],l=Math.min(Math.max(Math.min(a,r)/s,0),1),o=Math.min(Math.max(Math.max(a,r)/s,0),1);Math.abs(l-o)<.01?this.moveZoomWithMiddle(l):(this.state.start=l,this.state.end=o)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:s,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:i.clamp(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+s),y:e.y,width:this._activeState&&this._activeTag===Xt.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:i.clamp(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:s,height:this._activeState&&this._activeTag===Xt.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:s}=t,n=o(t,["formatMethod"]),{formatMethod:a}=e,r=o(e,["formatMethod"]),{start:l,end:d}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(d);const{position:h,width:u,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,i.merge({},n,{text:s?s(this._startValue):this._startValue,x:h.x+l*u,y:h.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${h}`),this._endText=this.maybeAddLabel(this._container,i.merge({},r,{text:a?a(this._endValue):this._endValue,x:h.x+d*u,y:h.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${h}`)):(this._startText=this.maybeAddLabel(this._container,i.merge({},n,{text:s?s(this._startValue):this._startValue,x:h.x+u/2,y:h.y+l*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${h}`),this._endText=this.maybeAddLabel(this._container,i.merge({},r,{text:a?a(this._endValue):this._endValue,x:h.x+u/2,y:h.y+d*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${h}`))}getLayoutAttrFromConfig(){var t,e,i,s;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:n,size:a,orient:r,middleHandlerStyle:l,startHandlerStyle:o,endHandlerStyle:d}=this.attribute,{width:h,height:u}=a,c=null!==(e=null===(t=null==l?void 0:l.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let b,g,p;(null==l?void 0:l.visible)?this._isHorizontal?(b=h,g=u-c,p={x:n.x,y:n.y+c}):(b=h-c,g=u,p={x:n.x+("left"===r?c:0),y:n.y}):(b=h,g=u,p=n);const v=null!==(i=null==o?void 0:o.size)&&void 0!==i?i:this._isHorizontal?g:b,m=null!==(s=null==d?void 0:d.size)&&void 0!==s?s:this._isHorizontal?g:b;return(null==o?void 0:o.visible)&&(this._isHorizontal?(b-=(v+m)/2,p={x:p.x+v/2,y:p.y}):(g-=(v+m)/2,p={x:p.x,y:p.y+v})),this._layoutAttrFromConfig={position:p,width:b,height:g},this._layoutAttrFromConfig}render(){var t,e,i,s,n,a,r,l,o,d,h,u,c,b,g,p,v,m,_,y,x;this._layoutAttrFromConfig=null;const{orient:f,backgroundStyle:A,backgroundChartStyle:S,selectedBackgroundStyle:E,selectedBackgroundChartStyle:L,middleHandlerStyle:k,startHandlerStyle:M,endHandlerStyle:B,brushSelect:w}=this.attribute,{start:T,end:C}=this.state,{position:P,width:O,height:I}=this.getLayoutAttrFromConfig(),H=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=H,this._background=H.createOrUpdateChild("background",Object.assign({x:P.x,y:P.y,width:O,height:I,cursor:w?"crosshair":"auto"},A),"rect"),(null===(t=null==S?void 0:S.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",H),(null===(e=null==S?void 0:S.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",H),w&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=H.createOrUpdateChild("selectedBackground",Object.assign({x:P.x+T*O,y:P.y,width:(C-T)*O,height:I,cursor:w?"crosshair":"move"},E),"rect"):this._selectedBackground=H.createOrUpdateChild("selectedBackground",Object.assign({x:P.x,y:P.y+T*I,width:O,height:(C-T)*I,cursor:w?"crosshair":"move"},E),"rect"),(null===(i=null==L?void 0:L.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",H),(null===(s=null==L?void 0:L.area)||void 0===s?void 0:s.visible)&&this.setSelectedPreviewAttributes("area",H),this.renderText(),this._isHorizontal?(this._startHandler=H.createOrUpdateChild("startHandler",Object.assign({x:P.x+T*O,y:P.y+I/2,size:I,angle:0,symbolType:null!==(n=null==M?void 0:M.symbolType)&&void 0!==n?n:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},M),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign({x:P.x+C*O,y:P.y+I/2,size:I,angle:0,symbolType:null!==(a=null==B?void 0:B.symbolType)&&void 0!==a?a:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},B),"symbol"),(null==k?void 0:k.visible)&&(this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign({x:P.x+T*O,y:P.y-((null===(r=null==k?void 0:k.background)||void 0===r?void 0:r.size)||10),width:(C-T)*O,height:(null===(l=null==k?void 0:k.background)||void 0===l?void 0:l.size)||10},null===(o=null==k?void 0:k.background)||void 0===o?void 0:o.style),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:P.x+(T+C)/2*O,y:P.y-((null===(d=null==k?void 0:k.background)||void 0===d?void 0:d.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(u=null===(h=null==k?void 0:k.icon)||void 0===h?void 0:h.symbolType)&&void 0!==u?u:"square"},null==k?void 0:k.icon),"symbol"))):(this._startHandler=H.createOrUpdateChild("startHandler",Object.assign({x:P.x+O/2,y:P.y+T*I,size:O,angle:Math.PI/180*90,symbolType:null!==(c=null==M?void 0:M.symbolType)&&void 0!==c?c:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},M),"symbol"),(null==k?void 0:k.visible)&&(this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===f?P.x-((null===(b=null==k?void 0:k.background)||void 0===b?void 0:b.size)||10):P.x+O,y:P.y+T*I,width:(null===(g=null==k?void 0:k.background)||void 0===g?void 0:g.size)||10,height:(C-T)*I},null===(p=null==k?void 0:k.background)||void 0===p?void 0:p.style),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===f?P.x-((null===(v=null==k?void 0:k.background)||void 0===v?void 0:v.size)||10)/2:P.x+O+((null===(m=null==k?void 0:k.background)||void 0===m?void 0:m.size)||10)/2,y:P.y+(T+C)/2*I,angle:Math.PI/180*90,symbolType:null!==(y=null===(_=null==k?void 0:k.icon)||void 0===_?void 0:_.symbolType)&&void 0!==y?y:"square",strokeBoundsBuffer:0},null==k?void 0:k.icon),"symbol")),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign({x:P.x+O/2,y:P.y+C*I,size:O,angle:Math.PI/180*90,symbolType:null!==(x=null==B?void 0:B.symbolType)&&void 0!==x?x:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},B),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,a;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],a=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],a=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],a=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:a}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i}=this.attribute,{start:s,end:n}=this.state,{position:a,width:r,height:l}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?a.x+s*r:a.x,y:this._isHorizontal?a.y:a.y+s*l,width:this._isHorizontal?(n-s)*r:r,height:this._isHorizontal?l:(n-s)*l,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?a.x+s*r:a.x),y:-(this._isHorizontal?a.y:a.y+s*l),width:this._isHorizontal?(n-s)*r:r,height:this._isHorizontal?l:(n-s)*l,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new w(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:s,end:n}=this.attribute;i.isValid(t)&&i.isValid(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,s===this.state.start&&n===this.state.end||(this.setAttributes({start:t,end:e}),this._updateStateCallback&&this._updateStateCallback(t,e)))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,s,n;const{middleHandlerStyle:a}=this.attribute,r=null!==(e=null===(t=null==a?void 0:a.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,l=null!==(n=null===(s=null==a?void 0:a.icon)||void 0===s?void 0:s.size)&&void 0!==n?n:10;return Math.max(r,...i.array(l))}setUpdateStateCallback(t){i.isFunction(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){i.isFunction(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){i.isFunction(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){i.isFunction(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){i.isFunction(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){i.isFunction(t)&&(this._statePointToData=t)}}var Zt,Jt,Kt;qt.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},t.IMarkLineLabelPosition=void 0,(Zt=t.IMarkLineLabelPosition||(t.IMarkLineLabelPosition={})).start="start",Zt.middle="middle",Zt.end="end",Zt.insideStartTop="insideStartTop",Zt.insideStartBottom="insideStartBottom",Zt.insideMiddleTop="insideMiddleTop",Zt.insideMiddleBottom="insideMiddleBottom",Zt.insideEndTop="insideEndTop",Zt.insideEndBottom="insideEndBottom",t.IMarkAreaLabelPosition=void 0,(Jt=t.IMarkAreaLabelPosition||(t.IMarkAreaLabelPosition={})).left="left",Jt.right="right",Jt.top="top",Jt.bottom="bottom",Jt.middle="middle",Jt.insideLeft="insideLeft",Jt.insideRight="insideRight",Jt.insideTop="insideTop",Jt.insideBottom="insideBottom",t.IMarkPointItemPosition=void 0,(Kt=t.IMarkPointItemPosition||(t.IMarkPointItemPosition={})).top="top",Kt.bottom="bottom",Kt.middle="middle",Kt.insideTop="insideTop",Kt.insideBottom="insideBottom",Kt.insideMiddle="insideMiddle";class Qt extends a{constructor(){super(...arguments),this.name="marker"}_initContainer(){var t,i;const{limitRect:s,clipInRange:n}=this.attribute;let a;if(n){const n=e.createGroup(Object.assign(Object.assign({},s),{clip:!0,pickable:!1}));a=e.createGroup({x:-(null!==(t=null==s?void 0:s.x)&&void 0!==t?t:0),y:-(null!==(i=null==s?void 0:s.y)&&void 0!==i?i:0)}),n.add(a),this._containerClip=n,this.add(n)}else a=e.createGroup({x:0,y:0}),this.add(a);a.name="marker-container",this._container=a}_updateContainer(){var t,e,i;const{limitRect:s,clipInRange:n}=this.attribute;null===(t=this._containerClip)||void 0===t||t.setAttributes(Object.assign({},s)),this._container.setAttributes({x:n?-(null!==(e=null==s?void 0:s.x)&&void 0!==e?e:0):0,y:n?-(null!==(i=null==s?void 0:s.y)&&void 0!==i?i:0):0})}render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i&&(this._container?(this._updateContainer(),this.updateMarker()):(this._initContainer(),this.initMarker(this._container)))}}const te={startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:t.IMarkLineLabelPosition.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},ee={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},ie={label:{position:t.IMarkAreaLabelPosition.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},se={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},ne={top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}};function ae(t,e){const{x1:i,y1:s,x2:n,y2:a}=e,{x1:r,y1:l,x2:o,y2:d}=t.AABBBounds,{dx:h=0,dy:u=0}=t.attribute;let c=0,b=0;r<i&&(c=i-r),l<s&&(b=s-l),o>n&&(c=n-o),d>a&&(b=a-d),c&&t.setAttribute("dx",c+h),b&&t.setAttribute("dy",b+u)}class re extends Qt{constructor(t){super(i.merge({},re.defaultAttributes,t))}setLabelPos(){var t,e;const{label:i={},limitRect:s}=this.attribute,{position:n="end",refX:a=0,refY:r=0,confine:l}=i,o=this._line.getMainSegmentPoints(),d=null!==(t=this._line.getEndAngle())&&void 0!==t?t:0,h=a*Math.cos(d)+r*Math.cos(d-Math.PI/2),u=a*Math.sin(d)+r*Math.sin(d-Math.PI/2);let c;if(c=n.includes("start")||n.includes("Start")?{x:o[0].x+h,y:o[0].y+u}:n.includes("middle")||n.includes("Middle")?{x:(o[0].x+o[o.length-1].x)/2+h,y:(o[0].y+o[o.length-1].y)/2+u}:{x:o[o.length-1].x+h,y:o[o.length-1].y+u},this._label.setAttributes(Object.assign(Object.assign({},c),{angle:i.autoRotate?d+(null!==(e=null==i?void 0:i.refAngle)&&void 0!==e?e:0):0,textStyle:Object.assign(Object.assign({},ee[n]),i.textStyle)})),s&&l){const{x:t,y:e,width:i,height:n}=s;ae(this._label,{x1:t,y1:e,x2:t+i,y2:e+n})}}initMarker(t){const{points:e,startSymbol:i,endSymbol:s,label:n,lineStyle:a,mainSegmentIndex:r,multiSegment:l}=this.attribute,o=new xt({points:e,startSymbol:i,endSymbol:s,lineStyle:a,mainSegmentIndex:r,multiSegment:l});o.name="mark-line-line",this._line=o,t.add(o);const d=new w(Object.assign({},n));d.name="mark-line-label",this._label=d,t.add(d),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:s,endSymbol:n,label:a,lineStyle:r,mainSegmentIndex:l,multiSegment:o}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:s,endSymbol:n,lineStyle:r,mainSegmentIndex:l,multiSegment:o}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({dx:0,dy:0},a)),this.setLabelPos()}}re.defaultAttributes=te;class le extends Qt{constructor(t){super(i.merge({},le.defaultAttributes,t))}_getPositionByDirection(t,e){const{x1:i,x2:s,y1:n,y2:a}=this._area.AABBBounds;return e.includes("left")||e.includes("Left")?{x:i,y:(n+a)/2}:e.includes("right")||e.includes("Right")?{x:s,y:(n+a)/2}:e.includes("top")||e.includes("Top")?{x:(i+s)/2,y:n}:e.includes("bottom")||e.includes("Bottom")?{x:(i+s)/2,y:a}:{x:(i+s)/2,y:(n+a)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e}=this.attribute,i=null!==(t=null==e?void 0:e.position)&&void 0!==t?t:"middle",s=this._getPositionByDirection(this._area,i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},se[i]),e.textStyle)})),this.attribute.limitRect&&(null==e?void 0:e.confine)){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;ae(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:i,label:s,areaStyle:n}=this.attribute,a=e.createPolygon(Object.assign({points:i},n));a.name="mark-area-area",this._area=a,t.add(a);const r=new w(Object.assign({},s));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:s,areaStyle:n}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},n)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({dx:0,dy:0},s)),this.setLabelPos()}}le.defaultAttributes=ie;class oe extends Qt{constructor(t){super(i.merge({},oe.defaultAttributes,t))}setLabelPos(){}setItemAttributes(e,i,s,n){var a;if(!e)return;const{autoRotate:r=!0,refX:l=0,refY:o=0,refAngle:d=0,textStyle:h,richTextStyle:u,imageStyle:c,position:b=t.IMarkPointItemPosition.middle}=i,g=(null===(a=this._line)||void 0===a?void 0:a.getEndAngle())||0,p=l*Math.cos(g)+o*Math.cos(g-Math.PI/2),v=l*Math.sin(g)+o*Math.sin(g-Math.PI/2);"text"===n?e.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},ne[(null==i?void 0:i.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?e.setAttributes({dx:this.getItemDx(e,b,u)+((null==u?void 0:u.dx)||0),dy:this.getItemDy(e,b,u)+((null==u?void 0:u.dy)||0)}):"image"===n&&e.setAttributes({dx:this.getItemDx(e,b,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(e,b,c)+((null==c?void 0:c.dy)||0)}),e.setAttributes({x:s.x+(p||0),y:s.y+(v||0),angle:r&&g+d})}getItemDx(t,e,i){var s,n;const a=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-a:0}getItemDy(t,e,i){var s,n;const a=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-a:e.includes("middle")||e.includes("Middle")?-a/2:0}initItem(t,i){const{type:s="text",symbolStyle:n,richTextStyle:a,imageStyle:r,renderCustomCallback:l}=t;let o;return"symbol"===s?o=e.createSymbol(Object.assign(Object.assign({},i),n)):"text"===s?o=new w(Object.assign({},i)):"richText"===s?o=e.createRichText(Object.assign(Object.assign({},i),a)):"image"===s?o=e.createImage(Object.assign(Object.assign({},i),r)):"custom"===s&&l&&(o=l()),this.setItemAttributes(o,t,i,s),o}getItemLineAttr(t,e,i){let s=[];const{type:n="type-s"}=t;return s="type-do"===n?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===n?[e,{x:i.x,y:e.y},i]:"type-op"===n?[e,{x:e.x,y:i.y},i]:[e,i],s}setItemLineAttr(t,e,i,s){var n;const{startSymbol:a,endSymbol:r,lineStyle:l}=t,o=this.getItemLineAttr(t,e,i);null===(n=this._line)||void 0===n||n.setAttributes({points:o,startSymbol:a,endSymbol:r,lineStyle:l,visible:s})}getDecorativeLineAttr(t,e){var i;const s=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,n=this._line.getEndAngle()||0;return{startPointOffsetX:s/2*Math.cos(n-Math.PI/2),startPointOffsetY:s/2*Math.sin(n-Math.PI/2),endPointOffsetX:-s/2*Math.cos(n-Math.PI/2),endPointOffsetY:-s/2*Math.sin(n-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var s;const{lineStyle:n}=t,{startPointOffsetX:a,startPointOffsetY:r,endPointOffsetX:l,endPointOffsetY:o}=this.getDecorativeLineAttr(t,e);null===(s=this._decorativeLine)||void 0===s||s.setAttributes(Object.assign(Object.assign({points:[{x:e.x+a,y:e.y+r},{x:e.x+l,y:e.y+o}]},n),{visible:i}))}initMarker(t){var i;const{position:s,itemLine:n,itemContent:a}=this.attribute,r={x:s.x+((null==a?void 0:a.offsetX)||0),y:s.y+((null==a?void 0:a.offsetY)||0)},l=new xt({points:[]});l.name="mark-point-line",this._line=l,t.add(l);const o=e.createLine({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,s,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(i=null==n?void 0:n.decorativeLine)||void 0===i?void 0:i.visible);const d=this.initItem(a,r);this._item=d,t.add(d)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:s}=this.attribute,{type:n="text"}=s,a={x:e.x+((null==s?void 0:s.offsetX)||0),y:e.y+((null==s?void 0:s.offsetY)||0)};this.setItemLineAttr(i,e,a,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,a,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,s,a,n)}}oe.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const de={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class he extends a{getCurrent(){return this._current}constructor(t){super(i.merge({},he.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{var i,s;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const s=new e.CustomEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t});s.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(s)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const i=new e.CustomEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t});i.manager=null===(s=this.stage)||void 0===s?void 0:s.eventSystem.manager,this.dispatchEvent(i)}this._current>1&&this.preHandler.removeState("disable"),this._current<this._total&&this.nextHandler.removeState("disable"),this.text.setAttribute("text",`${this._current}/${this._total}`)}}render(){var t;this._reset();const{layout:s="horizontal",handler:n=de,total:a,defaultCurrent:r=1,textStyle:l,padding:o=0}=this.attribute;this._current=r;const d=i.normalizePadding(o),h="horizontal"===s,u=e.createGroup({x:0,y:0}),c=n.style||{},b=c.size||15,g=null!==(t=n.space)&&void 0!==t?t:8,p=n.state||{};let{preShape:v,nextShape:m}=n;v||(v=h?"triangleLeft":"triangleUp"),m||(m=h?"triangleRight":"triangleDown");const _=e.createSymbol(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:0,y:0,symbolType:v,size:b}));_.states=p,_.name="preHandler",this.preHandler=_,u.add(_);const{width:y,height:x}=B(`${a}/${a}`,Object.assign({textAlign:"center",textBaseline:"middle"},l)),f=i.isNumber(b)?b:b[0],A=i.isNumber(b)?b:b[1],S=e.createText(Object.assign({x:h?f/2+g+y/2:0,y:h?0:A/2+g+x/2,text:`${r}/${a}`,textAlign:"center",textBaseline:"middle",lineHeight:null==l?void 0:l.fontSize},l));this.text=S,u.add(S);const E=e.createSymbol(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:h?f+2*g+y:0,y:h?0:A+2*g+x,symbolType:m,size:b}));E.name="nextHandler",E.states=p,this.nextHandler=E,u.add(E),1===this._total?(_.addState("disable"),E.addState("disable")):1===this._current?_.addState("disable"):this._current===a&&E.addState("disable");const L=u.AABBBounds,k=L.width(),M=L.height();u.translateTo(0-L.x1+d[3],0-L.y1+d[0]),this.add(u),this.attribute.width=k+d[1]+d[3],this.attribute.height=M+d[0]+d[2],this._bindEvents()}_bindEvents(){this.preHandler&&(this.preHandler.addEventListener("pointerenter",this._onHover),this.preHandler.addEventListener("pointerleave",this._onUnHover),this.preHandler.addEventListener("pointerdown",this._onClick)),this.nextHandler&&(this.nextHandler.addEventListener("pointerenter",this._onHover),this.nextHandler.addEventListener("pointerleave",this._onUnHover),this.nextHandler.addEventListener("pointerdown",this._onClick))}_reset(){this.removeAllChild(),this._current=1,this._total=this.attribute.total,this.preHandler=this.nextHandler=this.text=null}}he.defaultAttributes={handler:de,textStyle:{fill:"rgb(51, 51, 51)",fontSize:12}};const ue=16,ce=8,be=12,ge=12;var pe,ve,me;t.LegendStateValue=void 0,(pe=t.LegendStateValue||(t.LegendStateValue={})).selected="selected",pe.unSelected="unSelected",pe.selectedHover="selectedHover",pe.unSelectedHover="unSelectedHover",pe.focus="focus",t.LegendEvent=void 0,(ve=t.LegendEvent||(t.LegendEvent={})).legendItemHover="legendItemHover",ve.legendItemUnHover="legendItemUnHover",ve.legendItemClick="legendItemClick",ve.legendItemAttributeUpdate="legendItemAttributeUpdate",t.LEGEND_ELEMENT_NAME=void 0,(me=t.LEGEND_ELEMENT_NAME||(t.LEGEND_ELEMENT_NAME={})).innerView="innerView",me.title="legendTitle",me.item="legendItem",me.itemShape="legendItemShape",me.itemLabel="legendItemLabel",me.itemValue="legendItemValue",me.focus="legendItemFocus";class _e extends a{constructor(){super(...arguments),this.name="legend",this._title=null}render(){this.removeAllChild();const{interactive:s=!0,title:n,padding:a=0}=this.attribute,r=i.normalizePadding(a),l=e.createGroup({x:r[3],y:r[0],pickable:s,childrenPickable:s});l.name=t.LEGEND_ELEMENT_NAME.innerView,this.add(l),this._innerView=l,(null==n?void 0:n.visible)&&this._renderTitle(n),this._renderContent(),this._adjustLayout(),s&&this._bindEvents();const o=this._innerView.AABBBounds;this.attribute.width=o.width()+r[1]+r[3],this.attribute.height=o.height()+r[0]+r[2]}_renderTitle(e){const{text:s="",textStyle:n,padding:a=0,background:r,minWidth:l,maxWidth:o,shape:d}=e,h={x:0,y:0,text:s,textStyle:n,padding:i.normalizePadding(a),minWidth:l,maxWidth:o};d&&d.visible&&(h.shape=Object.assign({visible:!0},d.style),i.isValid(d.space)&&(h.space=d.space)),r&&r.visible&&(h.panel=Object.assign({visible:!0},r.style));const u=new w(h);u.name=t.LEGEND_ELEMENT_NAME.title,this._title=u,this._innerView.add(u)}_adjustLayout(){var t;if(this._title){const e=this._innerView.AABBBounds.width(),i=this._title.AABBBounds.width(),s=null===(t=this.attribute.title)||void 0===t?void 0:t.align;"center"===s?this._title.setAttribute("x",(e-i)/2):"end"===s&&this._title.setAttribute("x",e-i)}}}const ye={[t.LegendStateValue.focus]:{},[t.LegendStateValue.selected]:{},[t.LegendStateValue.selectedHover]:{},[t.LegendStateValue.unSelected]:{},[t.LegendStateValue.unSelectedHover]:{}};class xe extends _e{constructor(e){super(i.merge({},xe.defaultAttributes,e)),this.name="discreteLegend",this._itemsContainer=null,this._itemHeightByUser=void 0,this._itemHeight=0,this._itemMaxWidth=0,this._onHover=e=>{var i;const s=e.target;if(null===(i=null==s?void 0:s.name)||void 0===i?void 0:i.startsWith(t.LEGEND_ELEMENT_NAME.item)){const i=s.delegate;i.hasState(t.LegendStateValue.selected)?this._setLegendItemState(i,t.LegendStateValue.selectedHover,e):this._setLegendItemState(i,t.LegendStateValue.unSelectedHover,e);const n=i.getChildren()[0].find((e=>e.name===t.LEGEND_ELEMENT_NAME.focus),!1);n&&n.setAttribute("visible",!0),this._dispatchEvent(t.LegendEvent.legendItemHover,i,e)}},this._onUnHover=e=>{var i;const s=e.target;if(null===(i=null==s?void 0:s.name)||void 0===i?void 0:i.startsWith(t.LEGEND_ELEMENT_NAME.item)){const i=s.delegate;let n=!1;(i.hasState(t.LegendStateValue.unSelectedHover)||i.hasState(t.LegendStateValue.selectedHover))&&(n=!0),i.removeState(t.LegendStateValue.unSelectedHover),i.removeState(t.LegendStateValue.selectedHover),i.getChildren()[0].getChildren().forEach((e=>{n||!e.hasState(t.LegendStateValue.unSelectedHover)&&!e.hasState(t.LegendStateValue.selectedHover)||(n=!0),e.removeState(t.LegendStateValue.unSelectedHover),e.removeState(t.LegendStateValue.selectedHover)}));const a=i.getChildren()[0].find((e=>e.name===t.LEGEND_ELEMENT_NAME.focus),!1);a&&a.setAttribute("visible",!1),n&&this._dispatchEvent(t.LegendEvent.legendItemAttributeUpdate,i,e),this._dispatchEvent(t.LegendEvent.legendItemUnHover,i,e)}},this._onClick=e=>{var i,s,n,a,r;const l=e.target;if(null===(i=null==l?void 0:l.name)||void 0===i?void 0:i.startsWith(t.LEGEND_ELEMENT_NAME.item)){const i=l.delegate;if(l.name===t.LEGEND_ELEMENT_NAME.focus){const a=i.hasState(t.LegendStateValue.focus);i.toggleState(t.LegendStateValue.focus),a?null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((i=>{this._removeLegendItemState(i,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover,t.LegendStateValue.focus],e),this._setLegendItemState(i,t.LegendStateValue.selected,e)})):(this._setLegendItemState(i,t.LegendStateValue.selected,e),this._removeLegendItemState(i,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover],e),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((s=>{i!==s&&(this._removeLegendItemState(s,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover,t.LegendStateValue.focus],e),this._setLegendItemState(s,t.LegendStateValue.unSelected,e))})))}else{null===(a=this._itemsContainer)||void 0===a||a.getChildren().forEach((e=>{e.removeState(t.LegendStateValue.focus)}));const{selectMode:s="multiple",allowAllCanceled:n=!0}=this.attribute,l=i.hasState(t.LegendStateValue.selected),o=this._getSelectedLegends();if("multiple"===s){if(!1===n&&l&&1===o.length)return void this._dispatchEvent(t.LegendEvent.legendItemClick,i,e);l?(this._removeLegendItemState(i,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover],e),this._setLegendItemState(i,t.LegendStateValue.unSelected,e)):(this._setLegendItemState(i,t.LegendStateValue.selected,e),this._removeLegendItemState(i,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover],e))}else this._setLegendItemState(i,t.LegendStateValue.selected,e),this._removeLegendItemState(i,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover],e),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((s=>{i!==s&&(this._removeLegendItemState(s,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover],e),this._setLegendItemState(s,t.LegendStateValue.unSelected,e))}))}this._dispatchEvent(t.LegendEvent.legendItemClick,i,e)}}}setSelected(e){var i;(null===(i=this._itemsContainer)||void 0===i?void 0:i.getChildren()).forEach((i=>{const s=i.data;e.includes(s.label)?(this._setLegendItemState(i,t.LegendStateValue.selected),this._removeLegendItemState(i,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover])):(this._removeLegendItemState(i,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover]),this._setLegendItemState(i,t.LegendStateValue.unSelected))}))}_renderContent(){const{item:t={},items:s,reversed:n,maxCol:a=1,maxRow:r=2}=this.attribute;if(!1===t.visible||i.isEmpty(s))return;let l=s;n&&(l=null==s?void 0:s.reverse());const o=e.createGroup({x:0,y:0});this._itemsContainer=o;const{layout:d,maxWidth:h,maxHeight:u,defaultSelected:c=[],autoPage:b}=this.attribute,g="horizontal"===d,{spaceCol:p=ue,spaceRow:v=ce,maxWidth:m,width:_,height:y}=t;i.isValid(m)?i.isValid(_)?this._itemWidthByUser=Math.min(m,_):this._itemWidthByUser=m:i.isValid(_)&&(this._itemWidthByUser=_),i.isValid(y)&&(this._itemHeightByUser=y);let x=!1,f=0,A=0,S=0,E=1,L=1;l.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const s=this._renderEachItem(t,!!i.isEmpty(c)||(null==c?void 0:c.includes(t.label)),e,l),n=s.attribute.width,d=s.attribute.height;this._itemHeight=Math.max(this._itemHeight,d),f=Math.max(n,f),this._itemMaxWidth=Math.max(n,this._itemMaxWidth),g?(E=r,i.isValid(h)&&(n>=h?(x=!0,e>0&&(A=0,S+=d+v,L+=1)):h<A+n&&(x=!0,A=0,S+=d+v,L+=1)),e>0&&s.setAttributes({x:A,y:S}),A+=p+n):(E=a,i.isValid(u)&&u<S+d&&(x=!0,S=0,A+=f+p,f=0,L+=1),e>0&&s.setAttributes({x:A,y:S}),S+=v+d),o.add(s)}));let k=!1;x&&b&&L>E&&(k=this._renderPager(g)),k||(o.setAttribute("y",this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",8):0),this._innerView.add(o))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(s,n,a,r){const{id:l,label:o,value:d,shape:h}=s,{padding:u=0,focus:c,focusIconStyle:b={}}=this.attribute.item;let{shape:g={},label:p={},value:v={},background:m={}}=this.attribute.item;g=this._handleStyle(g,s,n,a,r),p=this._handleStyle(p,s,n,a,r),v=this._handleStyle(v,s,n,a,r),m=this._handleStyle(m,s,n,a,r);const _=i.normalizePadding(u);let y;!1===m.visible?(y=e.createGroup({x:0,y:0,cursor:(null==m?void 0:m.style).cursor}),this._appendDataToShape(y,t.LEGEND_ELEMENT_NAME.item,s,y)):(y=e.createGroup(Object.assign({x:0,y:0},null==m?void 0:m.style)),this._appendDataToShape(y,t.LEGEND_ELEMENT_NAME.item,s,y,null==m?void 0:m.state)),y.addState(n?t.LegendStateValue.selected:t.LegendStateValue.unSelected);const x=e.createGroup({x:0,y:0,pickable:!1});y.add(x);let f=0;const A=i.get(g,"style.size",10),S=i.get(g,"space",8),E=e.createSymbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),g.style));let L;Object.keys(g.state||{}).forEach((t=>{const e=g.state[t].fill||g.state[t].stroke;h.fill&&i.isNil(g.state[t].fill)&&e&&(g.state[t].fill=e),h.stroke&&i.isNil(g.state[t].stroke)&&e&&(g.state[t].stroke=e)})),this._appendDataToShape(E,t.LEGEND_ELEMENT_NAME.itemShape,s,y,null==g?void 0:g.state),E.addState(n?t.LegendStateValue.selected:t.LegendStateValue.unSelected),x.add(E);let k=0;if(c){const n=i.get(b,"size",10);L=e.createSymbol(Object.assign(Object.assign({x:0,y:-n/2-1,strokeBoundsBuffer:0},b),{visible:!1,pickMode:"imprecise",boundsPadding:_})),this._appendDataToShape(L,t.LEGEND_ELEMENT_NAME.focus,s,y),k=n}const M=e.createText(Object.assign(Object.assign({x:A/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==p?void 0:p.style).fontSize},null==p?void 0:p.style),{text:p.formatMethod?p.formatMethod(o,s,a):o}));this._appendDataToShape(M,t.LEGEND_ELEMENT_NAME.itemLabel,s,y,null==p?void 0:p.state),M.addState(n?t.LegendStateValue.selected:t.LegendStateValue.unSelected),x.add(M);const B=i.get(p,"space",8);if(f+=A/2+S+M.AABBBounds.width()+B,i.isValid(d)){const r=i.get(v,"space",c?8:0),l=e.createText(Object.assign(Object.assign({x:f+B,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==v?void 0:v.style).fontSize},null==v?void 0:v.style),{text:v.formatMethod?v.formatMethod(d,s,a):d}));if(this._appendDataToShape(l,t.LEGEND_ELEMENT_NAME.itemValue,s,y,null==v?void 0:v.state),l.addState(n?t.LegendStateValue.selected:t.LegendStateValue.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-_[1]-_[3]-A-S-B-k-r,e=l.AABBBounds,i=M.AABBBounds,s=e.width(),n=i.width();n>t?(t-s)/n>.4?M.setAttribute("maxLineWidth",t-s):(l.setAttribute("maxLineWidth",.5*t),M.setAttribute("maxLineWidth",.5*t)):l.setAttribute("maxLineWidth",t-n),v.alignRight&&l.setAttributes({textAlign:"right",x:this._itemWidthByUser-A/2-_[1]-_[3]-k-r})}f=l.AABBBounds.x2+r,x.add(l)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-_[1]-_[3]-A-S-k);L&&(L.setAttribute("x",f),x.add(L));const w=x.AABBBounds,T=w.width(),C=w.height(),P=i.isValid(this.attribute.item.width)?this.attribute.item.width:T+_[1]+_[3],O=this._itemHeightByUser||C+_[0]+_[2];return y.attribute.width=P,y.attribute.height=O,x.translateTo(-w.x1+_[3],-w.y1+_[0]),y}_renderPager(t){const s=this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",8):0,{maxWidth:n,maxHeight:a,maxCol:r=1,maxRow:l=2,item:d={},pager:h={}}=this.attribute,{spaceCol:u=ue,spaceRow:c=ce}=d,b=this._itemsContainer,{animation:g=!0,animationDuration:p=450,animationEasing:v="quadIn",space:m=ge}=h,_=o(h,["animation","animationDuration","animationEasing","space"]);let y,x=0,f=0,A=0,S=0,E=1;if(t){if(y=new he(Object.assign({layout:1===l?"horizontal":"vertical",total:99},i.merge({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},_))),this._pager=y,this._innerView.add(y),x=(l-1)*c+this._itemHeight*l,f=n-y.AABBBounds.width()-m,f<=0)return this._innerView.removeChild(y),!1;b.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;f<A+i&&(A=0,S+=s+c,E+=1),e>0&&t.setAttributes({x:A,y:S}),A+=u+i})),y.setAttributes({total:Math.ceil(E/l),x:f,y:s+x/2-y.AABBBounds.height()/2})}else{if(y=new he(Object.assign({layout:"horizontal",total:99},_)),this._pager=y,this._innerView.add(y),f=this._itemMaxWidth*r+(r-1)*u,x=a-y.AABBBounds.height()-m-s,x<=0)return this._innerView.removeChild(y),!1;b.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;x<S+i&&(S=0,A+=this._itemMaxWidth+u,E+=1),e>0&&t.setAttributes({x:A,y:S}),S+=c+i})),y.setAttributes({total:Math.ceil(E/r),x:(f-y.AABBBounds.width())/2,y:a-y.AABBBounds.height()})}h.defaultCurrent>1&&(t?b.setAttribute("y",-(h.defaultCurrent-1)*(x+c)):b.setAttribute("x",-(h.defaultCurrent-1)*(f+u)));const L=e.createGroup({x:0,y:s,width:f,height:x,clip:!0,pickable:!1});L.add(b),this._innerView.add(L);const k=e=>{const{current:i}=e.detail;g?b.animate().to(t?{y:-(i-1)*(x+c)}:{x:-(i-1)*(f+u)},p,v):t?b.setAttribute("y",-(i-1)*(x+c)):b.setAttribute("x",-(i-1)*(f+u))};return this._pager.addEventListener("toPrev",k),this._pager.addEventListener("toNext",k),!0}_setLegendItemState(e,i,s){let n=!1;e.hasState(i)||(n=!0),e.addState(i,true),e.getChildren()[0].getChildren().forEach((e=>{e.name!==t.LEGEND_ELEMENT_NAME.focus&&(n||e.hasState(i)||(n=!0),e.addState(i,true))})),n&&this._dispatchEvent(t.LegendEvent.legendItemAttributeUpdate,e,s)}_removeLegendItemState(e,i,s){let n=!1;i.forEach((t=>{!n&&e.hasState(t)&&(n=!0),e.removeState(t)})),e.getChildren()[0].getChildren().forEach((e=>{e.name!==t.LEGEND_ELEMENT_NAME.focus&&i.forEach((t=>{!n&&e.hasState(t)&&(n=!0),e.removeState(t)}))})),n&&this._dispatchEvent(t.LegendEvent.legendItemAttributeUpdate,e,s)}_getSelectedLegends(){var e;const i=[];return null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{e.hasState(t.LegendStateValue.selected)&&i.push(e.data)})),i}_appendDataToShape(t,e,s,n,a={}){t.name=e,t.data=s,t.delegate=n,t.states=i.merge({},ye,a)}_dispatchEvent(i,s,n){var a;const r=this._getSelectedLegends();r.sort(((t,e)=>t.index-e.index));const l=r.map((t=>t.label)),o=new e.CustomEvent(i,{item:s,data:s.data,selected:s.hasState(t.LegendStateValue.selected),currentSelectedItems:r,currentSelected:l,event:n});o.manager=null===(a=this.stage)||void 0===a?void 0:a.eventSystem.manager,this.dispatchEvent(o)}_handleStyle(t,e,s,n,a){const r=i.merge({},t);return t.style&&i.isFunction(t.style)&&(r.style=t.style(e,s,n,a)),t.state&&Object.keys(t.state).forEach((l=>{t.state[l]&&i.isFunction(t.state[l])&&(r.state[l]=t.state[l](e,s,n,a))})),r}}var fe;function Ae(t){return i.isArray(t)?t:[t,t]}function Se(t){return t?"ew-resize":"ns-resize"}xe.defaultAttributes={layout:"horizontal",title:{align:"start",space:be,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:ue,spaceRow:ce,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:ge,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},t.SLIDER_ELEMENT_NAME=void 0,(fe=t.SLIDER_ELEMENT_NAME||(t.SLIDER_ELEMENT_NAME={})).innerView="innerView",fe.railContainer="sliderRailContainer",fe.rail="sliderRail",fe.startText="sliderStartText",fe.endText="sliderEndText",fe.startHandler="sliderStartHandler",fe.startHandlerText="startHandlerText",fe.endHandler="sliderEndHandler",fe.endHandlerText="sliderEndHandlerText",fe.track="sliderTrack",fe.trackContainer="sliderTrackContainer";class Ee extends a{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(t){super(i.merge({},Ee.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===e.vglobal.env?(e.vglobal.addEventListener("pointermove",this._onHandlerPointerMove),e.vglobal.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,s;t.stopPropagation();const{railWidth:n,railHeight:a,min:r,max:l}=this.attribute;if(l===r)return;let o,d,h,u=0;this._isHorizontal?(o=t.clientX,u=o-this._prePos,d=null===(s=this._currentHandler)||void 0===s?void 0:s.attribute.x,h=n):(o=t.clientY,u=o-this._prePos,d=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=a);const c=i.clamp(d+u,0,h),b=c/h*(l-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,c,b):this._updateHandler(this._currentHandler,c,b),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===e.vglobal.env)e.vglobal.removeEventListener("pointermove",this._onHandlerPointerMove),e.vglobal.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===e.vglobal.env?(e.vglobal.addEventListener("pointermove",this._onTrackPointerMove),e.vglobal.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:s,min:n,max:a}=this.attribute;if(a===n)return;const{startHandler:r,endHandler:l}=this._getHandlers();let o,d,h;this._isHorizontal?(o=t.clientX,d=this._track.attribute.width,h=e):(o=t.clientY,d=this._track.attribute.height,h=s);const u=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=i.clamp(t+u,0,h-d),s=e/h*(a-n)+n;this._updateHandler(r,e,s)}if(l){const t=this._isHorizontal?l.attribute.x:l.attribute.y,e=i.clamp(t+u,d,h),s=e/h*(a-n)+n;this._updateHandler(l,e,s),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==l?void 0:l.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==l?void 0:l.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==l?void 0:l.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==l?void 0:l.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===e.vglobal.env?(e.vglobal.removeEventListener("pointermove",this._onTrackPointerMove),e.vglobal.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:s,min:n,max:a}=this.attribute;if(a===n)return;const r=this._startHandler,l=this._endHandler;let o,d,h,u;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,d=null==r?void 0:r.attribute.x,h=null==l?void 0:l.attribute.x,u=e):(o=t.viewY-this._rail.globalAABBBounds.y1,d=null==r?void 0:r.attribute.y,h=null==l?void 0:l.attribute.y,u=s);const c=o/u*(a-n)+n;if(i.isValid(h)){const t=Math.abs(o-d)>Math.abs(o-h)?l:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const{layout:e,railWidth:s,railHeight:n,min:a,max:r}=this.attribute;if(r===a)return;const[l,o]=i.array(t),{startHandler:d,endHandler:h}=this._getHandlers(),u="vertical"===e?n:s,c=(l-a)/(r-a)*u;if(d&&this._updateHandler(d,c,l),h){const t=(o-a)/(r-a)*u;this._updateHandler(h,t,o)}this._updateTrack()}render(){var s,n;this.removeAllChild();const{layout:a="horizontal",railWidth:r,railHeight:l,startText:o,endText:d,min:h,max:u,showHandler:c=!0}=this.attribute;let{value:b}=this.attribute;i.isNil(b)&&(b=[h,u]),this._currentValue={startValue:Ae(b)[0],endValue:Ae(b)[1]};const g="horizontal"===a;this._isHorizontal=g;const p=e.createGroup({x:0,y:0});p.name=t.SLIDER_ELEMENT_NAME.innerView,this.add(p),this._innerView=p;let v,m=0;if(o&&o.visible){v=e.createText(Object.assign({x:g?0:r/2,y:g?l/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:o.text,lineHeight:null===(s=o.style)||void 0===s?void 0:s.fontSize},o.style)),v.name=t.SLIDER_ELEMENT_NAME.startText,p.add(v);const n=i.isValid(o.space)?o.space:0;m+=(g?v.AABBBounds.width():v.AABBBounds.height())+n}const _=e.createGroup({x:g?m:0,y:g?0:m});p.add(_);const y=e.createGroup({x:0,y:0});let x;if(y.name=t.SLIDER_ELEMENT_NAME.railContainer,this._railContainer=y,_.add(y),this._renderRail(y),m+=g?r:l,d&&d.visible){const s=i.isValid(d.space)?d.space:0;x=e.createText(Object.assign({x:g?m+s:r/2,y:g?l/2:m+s,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:d.text,lineHeight:null===(n=d.style)||void 0===n?void 0:n.fontSize},d.style)),x.name=t.SLIDER_ELEMENT_NAME.endText,p.add(x)}this._renderTrack(y),c&&(this._renderHandlers(_),this._bindEvents())}_renderRail(i){const{railWidth:s,railHeight:n,railStyle:a,slidable:r}=this.attribute;let l="default";!1!==r&&(l="pointer");const o=e.createRect(Object.assign({x:0,y:0,width:s,height:n,cursor:l},a));return o.name=t.SLIDER_ELEMENT_NAME.rail,i.add(o),this._rail=o,o}_renderHandlers(e){const{range:s,min:n,max:a,handlerSize:r=14,handlerStyle:l,handlerText:o,railHeight:d,railWidth:h,slidable:u}=this.attribute;let{value:c}=this.attribute;i.isNil(c)&&(c=[n,a]);const b=o&&o.visible,g=this._isHorizontal,p=g?h:d,[v,m]=Ae(c),_=a===n?s?0:p:(v-n)/(a-n)*p,y=this._renderHandler(Object.assign({x:g?_:h/2,y:g?d/2:_,size:r,strokeBoundsBuffer:0,cursor:!1===u?"default":Se(g)},l));if(y.name=t.SLIDER_ELEMENT_NAME.startHandler,this._startHandler=y,e.add(y),this._currentValue.startPos=_,b){const i=this._renderHandlerText(v,s?"start":"end");i.name=t.SLIDER_ELEMENT_NAME.startHandlerText,e.add(i),this._startHandlerText=i}if(s){const i=a===n?p:(m-n)/(a-n)*p,s=this._renderHandler(Object.assign({x:g?i:h/2,y:g?d/2:i,size:r,strokeBoundsBuffer:0,cursor:!1===u?"default":Se(g)},l));if(s.name=t.SLIDER_ELEMENT_NAME.endHandler,this._endHandler=s,e.add(s),this._currentValue.endPos=i,b){const i=this._renderHandlerText(m,"end");i.name=t.SLIDER_ELEMENT_NAME.endHandlerText,e.add(i),this._endHandlerText=i}}}_renderTrack(s){const{range:n,min:a,max:r,railHeight:l,railWidth:o,trackStyle:d,railStyle:h,slidable:u,value:c}=this.attribute;let b,g;if(i.isNil(c))n?(b=a,g=r):b=g=a;else if(n){const t=i.clampRange(c,a,r);b=t[0],g=t[1]}else b=a,g=i.clamp(c,a,r);const p=this._isHorizontal,v=p?o:l;n||(b=a);const m=e.createGroup({x:0,y:0,width:o,height:l,cornerRadius:null==h?void 0:h.cornerRadius,clip:!0,pickable:!1});m.name=t.SLIDER_ELEMENT_NAME.trackContainer;const _=i.isObject(n)&&!0===n.draggableTrack;let y;y=!1===u?"default":!1===n||!1===_?"pointer":Se(p);const x=r===a?v:(g-b)/(r-a)*v,f=r===a?0:(b-a)/(r-a)*v,A=e.createRect(Object.assign({x:p?f:0,y:p?0:f,width:p?x:o,height:p?l:x,cursor:y},d));A.name=t.SLIDER_ELEMENT_NAME.track,this._track=A,m.add(A),s.add(m)}_renderHandler(t){return e.createSymbol(t)}_renderHandlerText(t,i){var s,n,a;const{align:r,min:l,max:o,handlerSize:d=14,handlerText:h={},railHeight:u,railWidth:c,slidable:b}=this.attribute,g=this._isHorizontal,p=g?c:u,v=o===l?"start"===i?0:p:(t-l)/(o-l)*p,m=null!==(s=h.space)&&void 0!==s?s:4,_=Object.assign({text:(null==h?void 0:h.formatter)?h.formatter(t):t.toFixed(null!==(n=null==h?void 0:h.precision)&&void 0!==n?n:0),lineHeight:null===(a=h.style)||void 0===a?void 0:a.lineHeight,cursor:!1===b?"default":Se(g)},h.style);g?"top"===r?(_.textBaseline="bottom",_.textAlign="center",_.x=v,_.y=(u-d)/2-m):(_.textBaseline="top",_.textAlign="center",_.x=v,_.y=(u+d)/2+m):"left"===r?(_.textBaseline="middle",_.textAlign="end",_.x=(c-d)/2-m,_.y=v):(_.textBaseline="middle",_.textAlign="start",_.x=(c+d)/2+m,_.y=v);return e.createText(_)}_bindEvents(){const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),i.isObject(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(e,i,s){var n;const a=this._isHorizontal;e.setAttribute(a?"x":"y",i);const r=e.name===t.SLIDER_ELEMENT_NAME.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(s):s.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[a?"x":"y"]:i})}e.name===t.SLIDER_ELEMENT_NAME.startHandler?(this._currentValue.startValue=s,this._currentValue.startPos=i):(this._currentValue.endValue=s,this._currentValue.endPos=i)}_updateHandlerText(e,i,s){var n;const a=this._isHorizontal,{handlerText:r}=this.attribute;e.setAttributes({[a?"x":"y"]:i,text:(null==r?void 0:r.formatter)?r.formatter(s):s.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const l=e.name===t.SLIDER_ELEMENT_NAME.startHandlerText?this._startHandler:this._endHandler;l&&(null==l||l.setAttributes({[a?"x":"y"]:i})),e.name===t.SLIDER_ELEMENT_NAME.startHandlerText?(this._currentValue.startValue=s,this._currentValue.startPos=i):(this._currentValue.endValue=s,this._currentValue.endPos=i)}_dispatchChangeEvent(){var t;const i=!!this.attribute.range,s=this._currentValue,n=new e.CustomEvent("change",{value:i?[Math.min(s.endValue,s.startValue),Math.max(s.endValue,s.startValue)]:s.startValue,position:i?[Math.min(s.endPos,s.startPos),Math.max(s.endPos,s.startPos)]:s.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}}Ee.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class Le extends _e{constructor(t){super(i.merge({},Le.defaultAttributes,t)),this.name="colorLegend",this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:n,align:a,min:r,max:l,value:o,railWidth:d,railHeight:h,showHandler:u=!0,handlerSize:c,handlerStyle:b,railStyle:g,trackStyle:p,startText:v,endText:m,handlerText:_,showTooltip:y,tooltip:x}=this.attribute,f=[],A=(l-r)/(t.length-1);for(let e=0;e<t.length;e++)f.push(r+A*e);this._colorScale=(new s.LinearScale).domain(f,!0).range(t),this._color=this._getTrackColor();const S=new Ee({x:0,y:0,range:{draggableTrack:!0},slidable:e,layout:n,align:a,min:r,max:l,value:o,railWidth:d,railHeight:h,showHandler:u,handlerSize:c,handlerStyle:b,railStyle:g,trackStyle:Object.assign({fill:this._color},p),startText:v,endText:m,handlerText:_,showTooltip:y,tooltip:x});this._innerView.add(S),this._slider=S,S.translateTo(0-S.AABBBounds.x1,(this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",be):0)-S.AABBBounds.y1),this._updateColor()}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}_getTrackColor(){const{colors:t,layout:e}=this.attribute;if(i.isEmpty(t))return;const s=t.length;if(1===s)return t[0];const n=[];for(let e=0;e<s;e++){const i=e/(s-1);n.push({offset:i,color:t[e]})}const a="horizontal"===e;return{gradient:"linear",stops:n,x0:0,y0:0,x1:a?1:0,y1:a?0:1}}_updateColor(){const{layout:t="horizontal",colors:e,railWidth:i,railHeight:s}=this.attribute,{startHandler:n,endHandler:a,track:r}=this._slider,{startValue:l,endValue:o,startPos:d,endPos:h}=this._slider.currentValue,u=this._colorScale.scale(l),c=this._colorScale.scale(o);null==n||n.setAttribute("fill",u),null==a||a.setAttribute("fill",c);const b="horizontal"===t?i:s;if(Math.abs(d-h)!==b&&e&&e.length>1){const t=this._color.stops,e=Math.min(d,h),i=Math.max(d,h),s=e/b,n=i/b,a=n-s,u=t.filter((t=>t.offset>s&&t.offset<n)),c=Math.min(l,o),g=Math.max(l,o),p=this._colorScale.scale(c),v=this._colorScale.scale(g),m=[{offset:0,color:p}];u.forEach((t=>{m.push({offset:(t.offset-s)/a,color:t.color})})),m.push({offset:1,color:v}),r.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:m}))}}}function ke(t="bottom"){let e=0;const i=3.5,s=2.5;return"top"===t?`\n M${e},-6L${e-i},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+s},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-s},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-i},2.5\n v-5\n h7\n v5\n Z\n`}Le.defaultAttributes={layout:"horizontal",title:{align:"start",space:be,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class Me extends _e{constructor(t){super(i.merge({},Me.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:s,align:n,min:a,max:r,value:l,railWidth:o,railHeight:d,showHandler:h=!0,handlerSize:u,handlerStyle:c,railStyle:b,trackStyle:g,startText:p,endText:v,handlerText:m,showTooltip:_,tooltip:y,sizeBackground:x}=this.attribute,f=e.createGroup({x:0,y:0});this._innerView.add(f);const A=new Ee({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:s,align:n,min:a,max:r,value:l,railWidth:o,railHeight:d,showHandler:h,handlerSize:u,handlerStyle:Object.assign({symbolType:ke(n)},c),railStyle:b,trackStyle:g,startText:p,endText:v,handlerText:m,showTooltip:_,tooltip:y});f.add(A);let S,E=0;const L=12;"horizontal"===s?"top"===n?(S=`M0,0L${o},0L${o},12Z`,E=d):(S=`M0,12L${o},12L${o},0Z`,A.setAttribute("y",L)):"left"===n?S=`M${o},0L${o},0L${o+L},${d}L${o},${d}Z`:(S=`M0,${d}L12,${d}L12,0Z`,A.setAttribute("x",L));const k=e.createPath(Object.assign(Object.assign({x:0,y:E,path:S},x),{zIndex:0}));f.add(k);const M=this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",be):0;f.translate(0-f.AABBBounds.x1,M-f.AABBBounds.y1),this._slider=A}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}Me.defaultAttributes={layout:"horizontal",title:{align:"start",space:be,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}};class Be extends a{constructor(t){super(i.merge({},Be.defaultAttributes,t)),this.name="title"}render(){var t,e,s,n,a,r,l,o,d,h,u,c,b,g,p,v,m,_,y,x,f,A,S,E,L,k,M,B,w,T,C,P,O,I,H,V,z,j,R,N,D,$,W,U,F,G,Y,X,q,Z,J,K,Q,tt,et,it,st,nt,at,rt,lt,ot;const{text:dt,textStyle:ht,subtext:ut,subtextStyle:ct,width:bt,height:gt,minWidth:pt,maxWidth:vt,minHeight:mt,maxHeight:_t,align:yt,verticalAlign:xt,padding:ft=0}=this.attribute,At=i.normalizePadding(ft),St=this.createOrUpdateChild("title-container",{x:At[3],y:At[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ht?void 0:ht.visible))if(ht&&i.isValid(null==ht?void 0:ht.character)){const t={x:null!==(e=ht.x)&&void 0!==e?e:0,y:null!==(s=ht.y)&&void 0!==s?s:0,width:null!==(a=null!==(n=ht.width)&&void 0!==n?n:bt)&&void 0!==a?a:0,height:null!==(l=null!==(r=ht.height)&&void 0!==r?r:gt)&&void 0!==l?l:0,ellipsis:null===(o=ht.ellipsis)||void 0===o||o,wordBreak:null!==(d=ht.wordBreak)&&void 0!==d?d:"break-word",maxHeight:ht.maxHeight,maxWidth:ht.maxWidth,textConfig:ht.character};this._mainTitle=St.createOrUpdateChild("mainTitle",t,"richtext")}else i.isValid(dt)&&(this._mainTitle=St.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[dt]},ht),{maxLineWidth:null!==(h=null==ht?void 0:ht.maxLineWidth)&&void 0!==h?h:bt,heightLimit:null==ht?void 0:ht.heightLimit,lineClamp:null==ht?void 0:ht.lineClamp,ellipsis:null===(u=null==ht?void 0:ht.ellipsis)||void 0===u||u,x:0,y:0}),"wrapText"));const Et=this._mainTitle?null===(c=this._mainTitle)||void 0===c?void 0:c.AABBBounds.height():0,Lt=this._mainTitle?null===(b=this._mainTitle)||void 0===b?void 0:b.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&i.isValid(null==ct?void 0:ct.character)){const t={x:null!==(p=ct.x)&&void 0!==p?p:0,y:null!==(v=ct.y)&&void 0!==v?v:Et,width:null!==(_=null!==(m=ct.width)&&void 0!==m?m:bt)&&void 0!==_?_:0,height:null!==(x=null!==(y=ct.height)&&void 0!==y?y:gt)&&void 0!==x?x:0,ellipsis:null===(f=ct.ellipsis)||void 0===f||f,wordBreak:null!==(A=ct.wordBreak)&&void 0!==A?A:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._subTitle=St.createOrUpdateChild("subTitle",t,"richtext")}else i.isValid(ut)&&(this._subTitle=St.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[ut]},ct),{maxLineWidth:null!==(S=null==ct?void 0:ct.maxLineWidth)&&void 0!==S?S:bt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(E=null==ct?void 0:ct.ellipsis)||void 0===E||E,x:0,y:Et}),"wrapText"));const kt=this._subTitle?null===(L=this._subTitle)||void 0===L?void 0:L.AABBBounds.height():0,Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.width():0;let Bt=Math.max(Lt,Mt),wt=Et+(null!==(M=null==ct?void 0:ct.height)&&void 0!==M?M:kt);if(i.isValid(bt)&&(Bt=bt,null===(B=this._mainTitle)||void 0===B||B.setAttribute("maxLineWidth",bt),null===(w=this._subTitle)||void 0===w||w.setAttribute("maxLineWidth",bt)),i.isValid(gt)&&(wt=gt),i.isValid(pt)&&Bt<pt&&(Bt=pt),i.isValid(vt)&&(null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",vt),null===(C=this._subTitle)||void 0===C||C.setAttribute("maxLineWidth",vt),null===(P=this._mainTitle)||void 0===P||P.setAttribute("maxWidth",vt),null===(O=this._subTitle)||void 0===O||O.setAttribute("maxWidth",vt),Bt>vt&&(Bt=vt)),i.isValid(mt)&&wt<mt&&(wt=mt),i.isValid(_t)&&(null===(I=this._mainTitle)||void 0===I||I.setAttribute("maxHeight",_t),null===(H=this._subTitle)||void 0===H||H.setAttribute("maxHeight",_t-Et),wt>_t&&(wt=_t)),St.attribute.width=Bt+At[1]+At[3],St.attribute.height=wt+At[0]+At[2],i.isValid(yt)||i.isValid(null==ht?void 0:ht.align)){const t=(null==ht?void 0:ht.align)?null==ht?void 0:ht.align:yt,e=null!==(V=null==ht?void 0:ht.width)&&void 0!==V?V:Lt;"left"===t?(null===(z=this._mainTitle)||void 0===z||z.setAttribute("x",0),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","left")):"center"===t?(null===(R=this._mainTitle)||void 0===R||R.setAttribute("x",e/2),null===(N=this._mainTitle)||void 0===N||N.setAttribute("textAlign","center")):"right"===t&&(null===(D=this._mainTitle)||void 0===D||D.setAttribute("x",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textAlign","right"))}if(i.isValid(xt)||i.isValid(null==ht?void 0:ht.verticalAlign)){const t=(null==ht?void 0:ht.verticalAlign)?null==ht?void 0:ht.verticalAlign:xt,e=(null==ht?void 0:ht.height)?null==ht?void 0:ht.height:Bt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(U=this._mainTitle)||void 0===U||U.setAttribute("textBaseline","top")):"middle"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("y",e/2),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("y",e),null===(X=this._mainTitle)||void 0===X||X.setAttribute("textBaseline","bottom"))}if(i.isValid(yt)||i.isValid(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:yt,e=null!==(q=null==ct?void 0:ct.width)&&void 0!==q?q:Mt;"left"===t?(null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("x",0),null===(J=this._subTitle)||void 0===J||J.setAttribute("textAlign","left")):"center"===t?(null===(K=this._subTitle)||void 0===K||K.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(i.isValid(xt)||i.isValid(null==ht?void 0:ht.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:xt,e=Et,i=null!==(it=null==ct?void 0:ct.height)&&void 0!==it?it:0;"top"===t?(null===(st=this._subTitle)||void 0===st||st.setAttribute("y",e),null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("textBaseline","top")):"middle"===t?(null===(at=this._subTitle)||void 0===at||at.setAttribute("y",e+i/2),null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("y",e+i),null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("textBaseline","bottom"))}}}Be.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const we={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};const Te=(t,e)=>{let i=t.x0,s=t.x1;const n="number"==typeof e?t.thickness*e:t.thickness;let a=t.y0-t.thickness/2,r=t.y1-t.thickness/2;"center"===t.align?(a=t.y0-n/2,r=t.y1-n/2):"end"===t.align&&(a=t.y0+t.thickness/2-n,r=t.y1+t.thickness/2-n);let l=(i+s)/2,o=a+n,d=r+n;t.round&&(i=Math.round(i),s=Math.round(s),a=Math.round(a),r=Math.round(r),o=Math.round(o),d=Math.round(d),l=Math.round(l));const h=Math.abs(s-i)>1e-6,u=t.endArrow&&h?`L${s},${r-n/2}L${s+n},${(r+d)/2}L${s},${d+n/2}`:"",c=t.startArrow&&h?`L${i},${o+n/2}L${i-n},${(a+o)/2}L${i},${a-n/2}`:"";return!1===t.isSmooth?`M${i},${a}L${s},${r}${u}L${s},${d}L${i},${o}${c}Z`:`M${i},${a}\n C${l},${a},${l},${r},${s},${r}\n ${u}\n L${s},${d}\n C${l},${d},${l},${o},${i},${o}\n ${c}\n Z`},Ce=(t,e)=>{let i=t.y0,s=t.y1,n=t.x0-t.thickness/2,a=t.x1-t.thickness/2;const r="number"==typeof e?t.thickness*e:t.thickness;"center"===t.align?(n=t.x0-r/2,a=t.x1-r/2):"end"===t.align&&(n=t.x0+t.thickness/2-r,a=t.x1+t.thickness/2-r);let l=(i+s)/2,o=n+r,d=a+r;t.round&&(i=Math.round(i),s=Math.round(s),n=Math.round(n),a=Math.round(a),o=Math.round(o),d=Math.round(d),l=Math.round(l));const h=Math.abs(s-i)>1e-6,u=t.endArrow&&h?`L${a-r/2},${s}L${(a+d)/2},${s+r}L${d+r/2},${s}`:"",c=t.startArrow&&h?`L${o+r/2},${i}L${(o+n)/2},${i-r}L${n-r/2},${i}`:"";return!1===t.isSmooth?`M${n},${i}L${a},${s}${u}L${d},${s}L${o},${i}${c}Z`:`M${n},${i}\n C${n},${l},${a},${l},${a},${s}\n ${u}\n L${d},${s}\n C${d},${l},${o},${l},${o},${i}\n ${c}\n Z`};class Pe extends a{constructor(t){super(i.merge({},Pe.defaultAttributes,t))}render(){const{direction:t="horizontal"}=this.attribute,e="vertical"===t?Ce:Te,i="number"==typeof this.attribute.ratio&&this.attribute.ratio>=0&&this.attribute.ratio<=1,s=["direction","x0","x1","y0","y1","thickness","round","ratio","align","isSmooth","backgroudStyle"],n={};if(Object.keys(this.attribute).forEach((t=>{s.includes(t)||(n[t]=this.attribute[t])})),i){const t=this.createOrUpdateChild("sankey-link-background",Object.assign({},n,this.attribute.backgroudStyle,{path:e(this.attribute,1),visible:!0,pickable:!1,zIndex:-1}),"path");this._backPath=t}else this._backPath&&this._backPath.setAttribute("visible",!1);const a=this.createOrUpdateChild("sankey-link-front",Object.assign({},n,{path:e(this.attribute,i?this.attribute.ratio:1),pickable:!1}),"path");this._frontPath=a}}Pe.defaultAttributes={direction:"horizontal",align:"start"};class Oe extends e.Symbol{constructor(t){super(t)}}var Ie,He;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(Ie||(Ie={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(He||(He={}));class Ve extends a{constructor(t){super(i.merge({},Ve.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},Ve.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},Ve.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},Ve.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},Ve.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s,n,a,r,l;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(s=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==s?s:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(a=null===(n=this._backwardAttr.style)||void 0===n?void 0:n.symbolType)&&void 0!==a?a:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(l=null===(r=this._forwardAttr.style)||void 0===r?void 0:r.symbolType)&&void 0!==l?l:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{i.isNil(this._playController)&&(this._playController=new Oe(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{i.isNil(this._backwardController)&&(this._backwardController=new Oe(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{i.isNil(this._forwardController)&&(this._forwardController=new Oe(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()}))},this._createCustomEvent=t=>{var i;const s=new e.CustomEvent(t,{eventType:t});return s.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,s},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{const t=this._createCustomEvent(Ie.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(Ie.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(Ie.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(Ie.OnBackward);this.dispatchEvent(t)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}Ve.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},Ve.defaultAttributes={[He.Start]:{},[He.Pause]:{},[He.Backward]:{},[He.Forward]:{}};const ze={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},je=[200,10];var Re,Ne;t.DirectionEnum=void 0,(Re=t.DirectionEnum||(t.DirectionEnum={})).Default="default",Re.Reverse="reverse",t.PlayerEventEnum=void 0,(Ne=t.PlayerEventEnum||(t.PlayerEventEnum={})).change="change",Ne.play="play",Ne.pause="pause",Ne.backward="backward",Ne.forward="forward",Ne.end="end",Ne.OnChange="change",Ne.OnPlay="play",Ne.OnPause="pause",Ne.OnBackward="backward",Ne.OnForward="forward",Ne.OnEnd="end";const De=({direction:e,maxIndex:i,minIndex:s,dataIndex:n})=>(({direction:e,maxIndex:i,dataIndex:s})=>e===t.DirectionEnum.Default&&s===i)({direction:e,maxIndex:i,dataIndex:n})||(({direction:e,minIndex:i,dataIndex:s})=>e===t.DirectionEnum.Reverse&&s===i)({direction:e,minIndex:s,dataIndex:n}),$e=({direction:e,maxIndex:i,minIndex:s,dataIndex:n})=>(({direction:e,minIndex:i,dataIndex:s})=>e===t.DirectionEnum.Default&&s===i)({direction:e,minIndex:s,dataIndex:n})||(({direction:e,maxIndex:i,dataIndex:s})=>e===t.DirectionEnum.Reverse&&s===i)({direction:e,maxIndex:i,dataIndex:n}),We=t=>"top"===t||"bottom"===t;class Ue extends a{constructor(t){super(i.merge({},Ue.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,s;let n;i.isValidNumber(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=i.max(this._handlerStyle.size[0],this._handlerStyle.size[1]));const a={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:i.isValidNumber(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(We(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:je[1];a.layout="horizontal",a.railHeight=i,a.railWidth=t,a.x=this._layoutInfo.slider.x,a.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(s=this._railStyle.width)&&void 0!==s?s:je[1];a.layout="vertical",a.railWidth=e,a.railHeight=t,a.x=this._layoutInfo.slider.x,a.y=this._layoutInfo.slider.y}return a},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new Ee(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return We(this._orient)?(t.layout="horizontal",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(t.layout="vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new Ve(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,s,n,a,r,l,o,d,h,u,c,b,g,p,v,m;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._sliderVisible=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.visible,this._railStyle=Object.assign({},null===(s=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===s?void 0:s.railStyle),this._trackStyle=Object.assign({},null===(a=null===(n=this.attribute)||void 0===n?void 0:n.slider)||void 0===a?void 0:a.trackStyle),this._handlerStyle=Object.assign({},null===(l=null===(r=this.attribute)||void 0===r?void 0:r.slider)||void 0===l?void 0:l.handlerStyle),this._controllerVisible=null===(d=null===(o=this.attribute)||void 0===o?void 0:o.controller)||void 0===d?void 0:d.visible,this._start=Object.assign({},null===(u=null===(h=this.attribute)||void 0===h?void 0:h.controller)||void 0===u?void 0:u.start),this._pause=Object.assign({},null===(b=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===b?void 0:b.pause),this._forward=Object.assign({},null===(p=null===(g=this.attribute)||void 0===g?void 0:g.controller)||void 0===p?void 0:p.forward),this._backward=Object.assign({},null===(m=null===(v=this.attribute)||void 0===v?void 0:v.controller)||void 0===m?void 0:m.backward)}_initLayoutInfo(){var t,e,s;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),a=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),l=null!==(t=We(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:je[1],o=n.reduce(((t,e)=>{const s=e.style.size,n=i.isNumber(s)?s:i.max(s[0],s[1]);return t+e.space+n}),0),d=this._sliderVisible?(We(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(s=this._size)||void 0===s?void 0:s.height)-o:0,h=d-this.attribute.slider.space,u=a.reduce(((t,e)=>{const{key:s,space:n,style:{size:a}}=e,r=i.isNumber(a)?a:i.max(a[0],a[1]);return this._layoutInfo[s]=Object.assign(Object.assign({},this._layoutInfo[s]),{size:r,x:We(this._orient)?t+n:(this._size.width-r)/2,y:We(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:We(this._orient)?u+this.attribute.slider.space:(this._size.width-l)/2,y:We(this._orient)?(this._size.height-l)/2:u+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:s,space:n,style:{size:a}}=e,r=i.isNumber(a)?a:i.max(a[0],a[1]);return this._layoutInfo[s]=Object.assign(Object.assign({},this._layoutInfo[s]),{size:r,x:We(this._orient)?t+n:(this._size.width-r)/2,y:We(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),u+d)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,i){var s;const n=new e.CustomEvent(t,{eventType:t,index:i,value:this._data[i]});n.manager=null===(s=this.stage)||void 0===s?void 0:s.eventSystem.manager,this.dispatchEvent(n)}}Ue.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},ze),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},ze),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},ze),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},ze),{key:"backward",position:"start"})}};var Fe;t.IOperateType=void 0,(Fe=t.IOperateType||(t.IOperateType={})).drawStart="drawStart",Fe.drawEnd="drawEnd",Fe.drawing="drawing",Fe.moving="moving",Fe.moveStart="moveStart",Fe.moveEnd="moveEnd",Fe.brushClear="brushClear";const Ge={brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},Ye=5,Xe={debounce:i.debounce,throttle:i.throttle};class qe extends a{constructor(e){super(i.merge({},qe.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const s=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=e=>{var i;const{removeOnClick:s=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&s?(this._container.incrementalClearChild(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:t.IOperateType.brushClear,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})):this._outOfInteractiveRange(e)||this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?t.IOperateType.drawEnd:t.IOperateType.moveEnd,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,null===(i=this._operatingMask)||void 0===i||i.setAttribute("pickable",!1)}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",Xe[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),s=this._container.getChildren();for(let t=0;t<s.length;t++){const{points:n=[],dx:a=0,dy:r=0}=s[t].attribute,l=n.map((t=>({x:t.x+a,y:t.y+r})));if(i.polygonContainPoint(l,e.x,e.y))return this._operatingMask=s[t],!0}return!1}_initDraw(e){const{brushMode:i}=this.attribute,s=this.eventPosToStagePos(e);this._cacheDrawPoints=[s],this._isDrawedBeforeEnd=!1,"single"===i&&this._container.incrementalClearChild(),this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:t.IOperateType.drawStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(e){var i,s;this._cacheMovePoint=this.eventPosToStagePos(e),this._operatingMaskMoveDx=null!==(i=this._operatingMask.attribute.dx)&&void 0!==i?i:0,this._operatingMaskMoveDy=null!==(s=this._operatingMask.attribute.dy)&&void 0!==s?s:0;const{interactiveRange:n}=this.attribute,{minY:a=-1/0,maxY:r=1/0,minX:l=-1/0,maxX:o=1/0}=n,{x1:d,x2:h,y1:u,y2:c}=this._operatingMask.globalAABBBounds,b=l-d,g=o-h,p=a-u,v=r-c;this._operatingMaskMoveRangeX=[b,g],this._operatingMaskMoveRangeY=[p,v],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:t.IOperateType.moveStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(e){var i;const s=this.eventPosToStagePos(e),{x1:n=0,x2:a=0,y1:r=0,y2:l=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds,{sizeThreshold:o=Ye}=this.attribute;if(this._isDrawedBeforeEnd=!!(Math.abs(a-n)>o||Math.abs(r-l)>o),this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(s.x===(null==t?void 0:t.x)&&s.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(s);const d=this._computeMaskPoints();this._operatingMask.setAttribute("points",d),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:t.IOperateType.drawing,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(e){const i=this._cacheMovePoint,s=this.eventPosToStagePos(e);if(s.x===(null==i?void 0:i.x)&&s.y===(null==i?void 0:i.y))return;const n=s.x-i.x,a=s.y-i.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,l=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],a))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:l}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:t.IOperateType.moving,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:s=[0,0]}=this.attribute;let n=[];const a=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[a,{x:r.x,y:a.y},r,{x:a.x,y:r.y}]:"x"===t?[{x:a.x,y:s[0]},{x:r.x,y:s[0]},{x:r.x,y:s[1]},{x:a.x,y:s[1]}]:"y"===t?[{x:e[0],y:a.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:a.y}]:i.cloneDeep(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,s=e.createPolygon(Object.assign({points:i.cloneDeep(this._cacheDrawPoints),cursor:"move",pickable:!1},t));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:a=1/0}=e,r=this.eventPosToStagePos(t);return r.x>a||r.x<n||r.y>s||r.y<i}eventPosToStagePos(t){var e,i,s;const n=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==n?void 0:n.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==n?void 0:n.top)||0)-((null===(s=this.stage)||void 0===s?void 0:s.y)||0)}}render(){this.bindBrushEvents();const t=this.createOrUpdateChild("brush-container",{},"group");this._container=t}setUpdateDragMaskCallback(t){i.isFunction(t)&&(this._updateDragMaskCallback=t)}releaseBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.removeEventListener("pointerdown",this._onBrushStart),this.stage.removeEventListener("pointermove",Xe[t](this._onBrushing,e)),this.stage.removeEventListener("pointerup",this._onBrushEnd),this.stage.removeEventListener("pointerupoutside",this._onBrushEnd)}}qe.defaultAttributes=Ge;const Ze=(t,...e)=>{const s=[t.shape,...e.map((t=>null==t?void 0:t.shape))],n=[t.key,...e.map((t=>null==t?void 0:t.key))],a=[t.value,...e.map((t=>null==t?void 0:t.value))];return i.merge(t,...e,{shape:s.every(i.isNil)?void 0:i.merge({},...s),key:n.every(i.isNil)?void 0:i.merge({},...n),value:a.every(i.isNil)?void 0:i.merge({},...a)})},Je=t=>{const{width:e,height:s,wordBreak:n="break-word",textAlign:a,textBaseline:r,text:l}=t;return{width:e,height:s,wordBreak:n,textAlign:a,textBaseline:r,singleLine:!1,textConfig:i.array(l).map((e=>Object.assign(Object.assign({},t),{text:e})))}},Ke={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:E,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:E,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:E,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new i.AABBBounds).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},Qe=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"],ti="tooltip-title",ei="tooltip-content",ii="shape",si="value";class ni extends a{constructor(t){super(i.merge({},ni.defaultAttributes,t)),this.name="tooltip"}render(){const{visible:t,content:e,panel:s,keyWidth:n,valueWidth:a,hasContentShape:r,autoCalculatePosition:l,autoMeasure:o}=this.attribute;if(!t)return void this.hideAll();o&&ni.measureTooltip(this.attribute),l&&ni.calculateTooltipPosition(this.attribute);const d=i.normalizePadding(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},s),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild(ti,{visible:!0,x:d[3],y:d[0]},"group");const h=ni.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild(`${ti}-${ii}`,i.merge({symbolType:"circle"},h.shape,{visible:c(h)&&c(h.shape)}),"symbol"),h.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild(`${ti}-${si}`,Object.assign({visible:c(h)&&c(h.value)},Je(h.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild(`${ti}-${si}`,Object.assign({text:"",visible:c(h)&&c(h.value)},h.value),"text");const u=c(h.shape)?h.shape.size+h.shape.spacing:0,{textAlign:b,textBaseline:g}=h.value,p=s.width-d[3]-d[0]-u;"center"===b?this._tooltipTitle.setAttribute("x",u+p/2):"right"===b||"end"===b?this._tooltipTitle.setAttribute("x",u+p):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",h.height):"middle"===g?this._tooltipTitle.setAttribute("y",h.height/2):this._tooltipTitle.setAttribute("y",0);const v=c(h)?h.height+h.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild(ei,{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==e?void 0:e.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+v);let t=0;e.forEach(((e,s)=>{var l;const o=ni.getContentAttr(this.attribute,s);if(!c(o))return;const d=`${ei}-${s}`,h=this._tooltipContent.createOrUpdateChild(d,{visible:!0,x:0,y:t},"group");let u=0;if(c(o.shape)&&h.createOrUpdateChild(`${d}-${ii}`,Object.assign({visible:!0,x:o.shape.size/2,y:o.shape.size/2+((null!==(l=o.key.lineHeight)&&void 0!==l?l:o.key.fontSize)-o.shape.size)/2},o.shape),"symbol"),r&&(u+=o.shape.size+o.shape.spacing),c(o.key)){let t;t=o.key.multiLine?h.createOrUpdateChild(`${d}-key`,Object.assign(Object.assign({visible:!0},Je(o.key)),{textBaseline:"top"}),"richtext"):h.createOrUpdateChild(`${d}-key`,Object.assign(Object.assign({visible:!0},o.key),{textBaseline:"top"}),"text");const{textAlign:e}=o.key;"center"===e?t.setAttribute("x",u+n/2):"right"===e||"end"===e?t.setAttribute("x",u+n):t.setAttribute("x",u),t.setAttribute("y",0),u+=n+o.key.spacing}if(c(o.value)){let t;t=o.value.multiLine?h.createOrUpdateChild(`${d}-${si}`,Object.assign(Object.assign({visible:!0},Je(o.value)),{textBaseline:"top"}),"richtext"):h.createOrUpdateChild(`${d}-${si}`,Object.assign(Object.assign({visible:!0},o.value),{textBaseline:"top"}),"text");let e="right";i.isValid(o.value.textAlign)?e=o.value.textAlign:c(o.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+a/2):"right"===e||"end"===e?t.setAttribute("x",u+a):t.setAttribute("x",u),u+=a,t.setAttribute("y",0),h.add(t)}t+=o.height+o.spaceRow}))}}setAttributes(t,e){const s=Object.keys(t);this.attribute.autoCalculatePosition&&s.every((t=>Qe.includes(t)))?(this._mergeAttributes(t,s),i.isNil(this.attribute.panel.width)&&this.attribute.autoMeasure&&ni.measureTooltip(this.attribute),ni.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},e)):super.setAttributes(t,e)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:a,pointerY:r,positionX:l,positionY:o,parentBounds:d}=t;let h=a,u=r;return"left"===l?h-=e+s:"center"===l?h-=e/2:h+=s,"top"===o?u-=i+n:"middle"===o?u-=i/2:u+=n,h+e>d.x2&&(h-=e+s),u+i>d.y2&&(u-=i+n),h<d.x1&&(h=d.x1),u<d.y1&&(u=d.y1),t.x=h,t.y=u,t}static measureTooltip(t){const{content:s,contentStyle:n}=t,a=i.normalizePadding(t.padding),r=ni.getTitleAttr(t);let l=0,o=a[0]+a[2],d=0;const{value:h,shape:u}=r,{visible:b=!1,symbolType:g=""}=null!=u?u:{};if(i.isValid(h)){const{width:t,height:e}=M(h).quickMeasure(h.text);l=t,d=e}if(b&&e.builtinSymbolsMap[g]&&(l+=u.size+u.spacing,d=Math.max(u.size,d)),t.title&&(t.title.width=l,t.title.height=d),c(r)&&(o+=d+r.spaceRow),null==s?void 0:s.length){const i=[];if(s.forEach(((e,s)=>{const n=ni.getContentAttr(t,s);(e.key||e.value)&&c(n)&&i.push([e,n])})),i.length){let a=!1;const r=[],d=[],h=[];i.forEach((([t,s],l)=>{var u;const{key:b,value:g,shape:p,spaceRow:v}=s,m=c(p),_=null!==(u=null==p?void 0:p.symbolType)&&void 0!==u?u:"",y=M(b),x=M(g);let f=0;if(c(b)){const{width:t,height:e}=y.quickMeasure(b.text);d.push(t),f=Math.max(f,e)}if(c(g)){const{width:t,height:e}=x.quickMeasure(g.text);h.push(t),f=Math.max(f,e)}m&&e.builtinSymbolsMap[_]&&(a=!0,r.push(p.size),f=Math.max(p.size,f)),t.height=f,o+=f,l<i.length-1&&(o+=null!=v?v:n.spaceRow)}));const u=r.length?Math.max(...r):0,b=d.length?Math.max(...d):0,g=h.length?Math.max(...h):0;l=Math.max(b+g+n.key.spacing+n.value.spacing+(a?u+n.shape.spacing:0),l),s.forEach((t=>{t.width=l})),t.hasContentShape=a,t.keyWidth=b,t.valueWidth=g}}return t.panel.width=l+a[1]+a[3],t.panel.height=o,t}static getTitleAttr(t){return Ze({},ni.defaultAttributes.titleStyle,ni.defaultAttributes.title,t.titleStyle,t.title)}static getContentAttr(t,e){return Ze({},ni.defaultAttributes.contentStyle,t.contentStyle,t.content[e])}}ni.defaultAttributes=Ke;t.AbstractComponent=a,t.ArcInfo=vt,t.ArcLabel=mt,t.BasePlayer=Ue,t.Brush=qe,t.CircleAxis=jt,t.CircleAxisGrid=Yt,t.CircleCrosshair=D,t.ColorContinuousLegend=Le,t.ContinuousPlayer=class extends Ue{constructor(i){super(i),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(Ie.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(Ie.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(Ie.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(Ie.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)}))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=e=>{const i=Math.floor(e);i!==this._activeIndex&&(this._dataIndex=i,this._activeIndex=i,i!==this._maxIndex&&this.dispatchCustomEvent(t.PlayerEventEnum.change))},this.play=()=>h(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(t.PlayerEventEnum.play),this._rafId=e.vglobal.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=e.vglobal.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,e.vglobal.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(t.PlayerEventEnum.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,e.vglobal.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(t.PlayerEventEnum.pause))},this.backward=()=>{const e=Date.now(),i=1*this._interval,s=this._elapsed-i;s<=0?(this._elapsed=0,this._startTime=e):(this._elapsed=s,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(t.PlayerEventEnum.backward)},this.forward=()=>{const e=Date.now(),i=1*this._interval,s=this._elapsed+i;s>=this._totalDuration?(this._startTime=e-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-i,this._elapsed=s),this._updateSlider(),this.dispatchCustomEvent(t.PlayerEventEnum.forward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}},t.DEFAULT_ITEM_SPACE_COL=ue,t.DEFAULT_ITEM_SPACE_ROW=ce,t.DEFAULT_LABEL_SPACE=8,t.DEFAULT_PAGER_SPACE=ge,t.DEFAULT_SHAPE_SIZE=10,t.DEFAULT_SHAPE_SPACE=8,t.DEFAULT_STATES=St,t.DEFAULT_TITLE_SPACE=be,t.DEFAULT_VALUE_SPACE=8,t.DataLabel=yt,t.DataZoom=qt,t.DiscreteLegend=xe,t.DiscretePlayer=class extends Ue{constructor(s){super(i.merge({},s)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var e,s,n,a;super._initAttributes(),this._alternate=null!==(e=this.attribute.alternate)&&void 0!==e&&e,this._interval=null!==(s=this.attribute.interval)&&void 0!==s?s:1e3,this._direction=null!==(n=this.attribute.direction)&&void 0!==n?n:t.DirectionEnum.Default,this._dataIndex=i.isNil(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(a=this.attribute.dataIndex)&&void 0!==a?a:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(Ie.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(Ie.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(Ie.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(Ie.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(e=>{const i=Math.floor(e.detail.value)+.5;this._dataIndex=e.detail.value>=i?Math.ceil(e.detail.value):Math.floor(e.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(t.PlayerEventEnum.change)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(De({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||$e({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===t.DirectionEnum.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(t.PlayerEventEnum.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=e.vglobal.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=i=>{const s=Date.now();if(this._isReachEnd&&s-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();i&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(t.PlayerEventEnum.change),this._activeIndex=this._dataIndex):s-this._tickTime>=this._interval&&(this._tickTime=s,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(t.PlayerEventEnum.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=e.vglobal.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),e.vglobal.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(t.PlayerEventEnum.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,e.vglobal.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(t.PlayerEventEnum.pause))},this.backward=()=>{const e=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(e),this.dispatchCustomEvent(t.PlayerEventEnum.change),this.dispatchCustomEvent(t.PlayerEventEnum.backward)},this.forward=()=>{const e=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(e),this.dispatchCustomEvent(t.PlayerEventEnum.change),this.dispatchCustomEvent(t.PlayerEventEnum.forward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}},t.GroupFadeIn=Nt,t.GroupFadeOut=Dt,t.GroupTransition=Rt,t.Indicator=class extends a{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:s,content:n,size:a,limitRatio:r=1/0}=this.attribute,l=Math.min(a.width,a.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(i.isValid(s))if(!1!==s.visible){const t=i.merge({},i.get(we,"title.style"),s.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:i.isValid(t.lineHeight)?t.lineHeight:t.fontSize,visible:s.visible,x:0,y:0}),"text"),s.autoFit&&i.isValidNumber(l)&&this._setAutoFit(l,this._title,s),s.autoLimit&&i.isValidNumber(r)&&this._title.setAttribute("maxLineWidth",l)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const d=this._title?this._title.AABBBounds.height():0;if(i.isValid(n)){const t=this._title&&(null==s?void 0:s.space)?s.space:0,e=i.array(n),a=[];let h=0;e.forEach(((e,s)=>{if(!1!==e.visible){const n=i.merge({},i.get(we,"content.style"),e.style),u=o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},n),{lineHeight:i.isValid(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:d+t+h}),"text");e.autoFit&&i.isValidNumber(l)&&this._setAutoFit(l,u,e),e.autoLimit&&i.isValidNumber(r)&&u.setAttribute("maxLineWidth",l),a.push(u);const c=(null==e?void 0:e.space)?e.space:0;h+=u.AABBBounds.height()+c}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=a}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",a.height/2-h/2),o.setAttribute("x",a.width/2)}_setAutoFit(t,e,s){var n,a,r,l,o,d;const h=B(null!==(a=null===(n=s.style)||void 0===n?void 0:n.text)&&void 0!==a?a:"",null!==(r=s.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(l=s.fitPercent)&&void 0!==l?l:.5)/h,a=Math.floor((null!==(d=null===(o=s.style)||void 0===o?void 0:o.fontSize)&&void 0!==d?d:20)*n);e.setAttribute("fontSize",a),e.setAttribute("lineHeight",i.isValid(s.style.lineHeight)?s.style.lineHeight:a)}}},t.LabelBase=ot,t.LineAxis=Vt,t.LineAxisGrid=Gt,t.LineCrosshair=R,t.LineLabel=ut,t.LinkPath=Pe,t.MarkArea=le,t.MarkLine=re,t.MarkPoint=oe,t.Pager=he,t.PolygonCrosshair=W,t.PopTip=C,t.RectCrosshair=N,t.RectLabel=ht,t.ScrollBar=r,t.SectorCrosshair=$,t.Segment=xt,t.SizeContinuousLegend=Me,t.Slider=Ee,t.SymbolLabel=dt,t.Tag=w,t.Title=Be,t.Tooltip=ni,t.VTag=function(t){return new w(t?t.attribute:{})},t.getHorizontalPath=Te,t.getSizeHandlerPath=ke,t.getVerticalPath=Ce,t.loadPoptip=function(){e.container.load(z)},t.popTipModule=z,t.setPoptipTheme=function(t){i.merge(O.poptip,P,t)},t.version="0.16.0-alpha.1"}));