@visactor/vrender-components 0.14.1-alpha.3 → 0.14.1-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/core/type.js +2 -1
- package/cjs/crosshair/line.js +1 -2
- package/cjs/data-zoom/data-zoom.js +2 -2
- package/cjs/data-zoom/data-zoom.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/type.js +2 -1
- package/cjs/label/base.d.ts +5 -2
- package/cjs/label/base.js +24 -15
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/index.js +1 -2
- package/cjs/marker/base.js +4 -8
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/type.d.ts +0 -6
- package/cjs/marker/type.js.map +1 -1
- package/cjs/player/continuous-player.js +5 -5
- package/cjs/player/continuous-player.js.map +1 -1
- package/cjs/player/discrete-player.js +4 -4
- package/cjs/player/discrete-player.js.map +1 -1
- package/cjs/scrollbar/scrollbar.js +4 -4
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/cjs/slider/slider.js +8 -8
- package/cjs/slider/slider.js.map +1 -1
- package/dist/index.js +2173 -2226
- package/dist/index.min.js +1 -1
- package/es/core/type.js +2 -1
- package/es/crosshair/line.js +1 -2
- package/es/data-zoom/data-zoom.js +3 -3
- package/es/data-zoom/data-zoom.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/indicator/type.js +2 -1
- package/es/label/base.d.ts +5 -2
- package/es/label/base.js +22 -13
- package/es/label/base.js.map +1 -1
- package/es/label/index.js +1 -2
- package/es/marker/base.js +3 -9
- package/es/marker/base.js.map +1 -1
- package/es/marker/type.d.ts +0 -6
- package/es/marker/type.js.map +1 -1
- package/es/player/continuous-player.js +5 -5
- package/es/player/continuous-player.js.map +1 -1
- package/es/player/discrete-player.js +5 -5
- package/es/player/discrete-player.js.map +1 -1
- package/es/scrollbar/scrollbar.js +5 -5
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/es/slider/slider.js +9 -9
- package/es/slider/slider.js.map +1 -1
- package/package.json +7 -7
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 a=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class n extends e.Group{mode;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.merge(this.attribute[t],e):this.attribute[t]=e,a.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=>a.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 a=e[s];i.isPlainObject(this.attribute[a])?i.merge(this.attribute[a],t[a]):this.attribute[a]=t[a]}}bindEvents(){}_getNodeId(t){return`${this.id}-${this.name}-${t}`}}class r extends n{name="scrollbar";static 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]};_container;_slider;_rail;_sliderRenderBounds;_sliderLimitRange;_prePos;_viewPosition;_sliderSize;constructor(t){super(i.merge({},r.defaultAttributes,t))}setScrollRange(t,e=!0){const{direction:s="horizontal",limitRange:a=[0,1],range:n}=this.attribute,r=i.clampRange(t,a[0],a[1]);if(e){const t=this._getSliderPos(r);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),this.stage?.autoRender||this.stage?.renderNextFrame())}this.attribute.range=r,this._onChange({pre:n,value:r})}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:a,limitRange:n=[0,1],railStyle:r,sliderStyle:l,padding:o=2}=this.attribute,h=this.createOrUpdateChild("scrollbar-container",{},"group"),d=h.createOrUpdateChild("scrollbar-rail",{x:0,y:0,width:e,height:s,...r},"rect");this._rail=d;const c=this._getSliderRenderBounds(),u=this._getSliderPos(i.clampRange(a,n[0],n[1])),p=u[1]-u[0];let b;this._sliderSize=p,b="horizontal"===t?{x:u[0],y:c.y1,width:p,height:c.height}:{x:c.x1,y:u[0],width:c.width,height:p};const g=h.createOrUpdateChild("slider",{...b,cornerRadius:this._getDefaultSliderCornerRadius(),...l,boundsPadding:i.normalizePadding(o),pickMode:"imprecise"},"rect");this._slider=g,this._container=h;const _=this._container.AABBBounds;this._viewPosition={x:_.x1,y:_.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:s=2}=this.attribute,[a,n,r,l]=i.normalizePadding(s),o={x1:l,y1:a,x2:t-n,y2:e-r,width:t-(l+n),height:e-(a+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:a,y1:n}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+a,i*t[1]+a]:[s*t[0]+n,s*t[1]+n]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[s,a]=i.clampRange(t,0,1),{width:n,height:r,x1:l,y1:o}=this._getSliderRenderBounds(),h=this._sliderSize;return"horizontal"===e?i.clampRange([l+s*n,l+a*n],l,n-h):i.clampRange([o+s*r,o+a*r],o,r-h)}_onRailPointerDown=t=>{const{viewX:e,viewY:s}=t,{direction:a,width:n,height:r,range:l}=this.attribute,o=this._sliderSize,[h,d]=this._getScrollRange();let c;if("vertical"===a){const t=s-this._viewPosition.y,e=i.clamp(t-o/2,h,d);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,s=i.clamp(t-o/2,h,d);c=t/n,this._slider.setAttribute("x",s,!0)}this.setScrollRange([c-(l[1]-l[0])/2,c+(l[1]-l[0])/2],!1),this.stage?.autoRender||this.stage?.renderNextFrame()};_onSliderPointerDown=t=>{t.stopPropagation();const{direction:i}=this.attribute;this._prePos="horizontal"===i?t.clientX:t.clientY,"browser"===e.global.env?(e.global.addEventListener("pointermove",this._onSliderPointerMove),e.global.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))};_onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,s,a=0;const n=this.getScrollRange(),{width:r,height:l}=this._getSliderRenderBounds();"vertical"===e?(s=t.clientY,a=s-this._prePos,i=a/l):(s=t.clientX,a=s-this._prePos,i=a/r),this.setScrollRange([n[0]+i,n[1]+i],!0),this._prePos=s};_onSliderPointerUp=t=>{t.preventDefault(),"browser"===e.global.env?(e.global.removeEventListener("pointermove",this._onSliderPointerMove),e.global.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))};_onChange(t){const i=new e.CustomEvent("scroll",t);i.manager=this.stage?.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}}function l(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&l(t,e)}))}const o=t=>!i.isNil(t)&&!1!==t.visible;const h=["#ffffff","#000000"];function d(t,e,i,s,a){const n=b(t),r=b(e);return c(n,r,i,s)?n:function(t,e,i,s,a){const n=[];a&&(a instanceof Array?n.push(...a):n.push(a));n.push(...h);for(const a of n)if(t!==a&&c(a,e,i,s))return a;return}(n,r,i,s,a)}function c(t,e,i,s){return s?u(t,e)>s:"largeText"===i?u(t,e)>3:u(t,e)>4.5}function u(t,e){const i=p(t),s=p(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function p(t){const e=i.ColorUtil.hexToRgb(t),s=e[0]/255,a=e[1]/255,n=e[2]/255;let r,l,o;r=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),l=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4);return.2126*r+.7152*l+.0722*o}function b(t){if(t?.includes("#"))return t;const e=new i.ColorUtil.Color(t),{r:s,g:a,b:n}=e.color;return"#"+i.ColorUtil.rgbToHex(s,a,n)}function g(t,e){return[t[0]*e,t[1]*e]}function _(t,e,i){const s=function(t,e){const[i,s]=t,[a,n]=e,r=Math.sqrt((i*i+s*s)*(a*a+n*n)),l=r&&(i*a+s*n)/r;return Math.acos(Math.min(Math.max(l,-1),1))}(t,e),a=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?a?2*Math.PI-s:s:a?s:2*Math.PI-s}const y=-.5*Math.PI,m=1.5*Math.PI,x="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 f;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(f||(f={}));const v={[f.selectedReverse]:{},[f.selected]:{},[f.hover]:{},[f.hoverReverse]:{}},A=(t,s,a)=>new i.TextMeasure({defaultFontParams:{fontFamily:x,fontSize:11},getTextBounds:a?void 0:e.getTextBounds,specialCharSet:"-/: .,@%'\"~"+i.TextMeasure.ALPHABET_CHAR_SET+i.TextMeasure.ALPHABET_CHAR_SET.toUpperCase(),...s??{}},t);function S(t,i){if(!t)return{width:0,height:0};const s=e.getTextBounds({text:t,fontFamily:i.fontFamily??"",fontSize:i.fontSize||12,fontWeight:i.fontWeight,textAlign:i.textAlign??"center",textBaseline:i.textBaseline,ellipsis:!!i.ellipsis,maxLineWidth:i.maxLineWidth||1/0,lineHeight:i.fontSize||12});return{width:s.width(),height:s.height()}}class E extends n{name="tag";static defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};constructor(t){super(i.merge({},E.defaultAttributes,t))}render(){const{text:t="",textStyle:e={},shape:s={},panel:a={},space:n=4,minWidth:r,maxWidth:l,padding:o=4,visible:h,state:d}=this.attribute,c=i.normalizePadding(o),u=this.createOrUpdateChild("tag-content",{x:0,y:0,zIndex:1},"group");let p,b=c[1]+c[3],g=c[0]+c[2],_=0,y=0;const{visible:m,...x}=s;if(i.isBoolean(m)){const t=x?.size||10,e=i.isNumber(t)?t:Math.max(t[0],t[1]);p=u.createOrUpdateChild("tag-shape",{symbolType:"circle",size:t,strokeBoundsBuffer:0,...x,visible:m,x:e/2,y:e/2},"symbol"),i.isEmpty(d?.shape)||(p.states=d.shape),m&&(y=e+n)}b+=y,_+=y;const f={text:t,visible:i.isValid(t)&&!1!==h,lineHeight:e?.fontSize,...e,x:_,y:0};i.isNil(f.lineHeight)&&(f.lineHeight=f.fontSize);const v=u.createOrUpdateChild("tag-text",f,"text");i.isEmpty(d?.text)||(v.states=d.text);const A=S(f.text,e),E=A.width,k=A.height;b+=E;const L=s.size??10,B=i.isNumber(L)?L:Math.max(L[0],L[1]);g+=Math.max(k,s?.visible?B:0);const{textAlign:M,textBaseline:w}=e;(i.isValid(r)||i.isValid(l))&&(i.isValid(r)&&b<r&&(b=r),i.isValid(l)&&b>l&&(b=l,v.setAttribute("maxLineWidth",l-c[1]-c[2])));let T=0,C=0;"center"===M?(T-=b/2,p&&p.setAttribute("x",(p.attribute.x||0)-E/2),u.setAttribute("x",-y/2)):"right"===M||"end"===M?(T-=b,p&&p.setAttribute("x",(p.attribute.x||0)-E),u.setAttribute("x",-c[1]-y)):"left"!==M&&"start"!==M||u.setAttribute("x",c[3]),"middle"===w?(C-=g/2,p&&p.setAttribute("y",0)):"bottom"===w?(C-=g,p&&p.setAttribute("y",-k/2),u.setAttribute("y",-c[2])):"top"===w&&(u.setAttribute("y",c[0]),p&&p.setAttribute("y",k/2));const{visible:P,...I}=a;if(h&&i.isBoolean(P)){const e=this.createOrUpdateChild("tag-panel",{...I,visible:P&&!!t,x:T,y:C,width:b,height:g},"rect");i.isEmpty(d?.panel)||(e.states=d.panel)}}}class k extends n{name="poptip";static 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"},space:8,padding:10};constructor(t){super(i.merge({},k.defaultAttributes,t))}render(){const{title:t="",titleStyle:e={},position:s,content:a="",contentStyle:n={},panel:r={},space:l=4,minWidth:o=0,maxWidth:h=1/0,padding:d=4,visible:c,state:u,dx:p=0,dy:b=0}=this.attribute,g=i.normalizePadding(d),_=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group"),y=h-g[1]-g[3],m=i.isValid(t)&&!1!==c,x={text:t,visible:m,...e,x:g[3],y:g[0],maxLineWidth:y,textAlign:"left",textBaseline:"top"},f=_.createOrUpdateChild("poptip-title",x,"text");i.isEmpty(u?.title)||(f.states=u.title);const v=f.AABBBounds,A=v.height(),S=v.width();let E=A+l;m||(E=0);const k=i.isValid(a)&&!1!==c,L={text:a,visible:k,...n,x:g[3],y:g[0]+E,maxLineWidth:y,textAlign:"left",textBaseline:"top"},B=_.createOrUpdateChild("poptip-content",L,"text");i.isEmpty(u?.content)||(B.states=u.content);const M=B.AABBBounds,w=M.height(),T=M.width();k&&(E+=w);let C=i.max(S+g[1]+g[3],T+g[1]+g[3]);C>h?C=h:C<o&&(C=o);const P=g[0]+g[2]+E,{visible:I,...H}=r,z=H.size??12,V=i.isArray(z)?[z[0]+(H.space??0),z[1]+(H.space??0)]:z+(H.space??0),R=H.lineWidth??1,D=this.stage?[this.stage.width,this.stage.height]:void 0,N="auto"===s;let O,$=1/0;for(let t=0;t<this.positionList.length+1;t++){const e=N?this.positionList[t===this.positionList.length?O:t]:s,{angle:a,offset:n,rectOffset:r}=this.getAngleAndOffset(e,C,P,i.isArray(V)?V:[V,V-R]);if(i.isBoolean(I)){const t=(i.isArray(z)?z[0]:z)/4,e=_.createOrUpdateChild("poptip-symbol-panel",{...H,visible:I&&(k||m),x:t,y:0,strokeBoundsBuffer:-1,boundsPadding:-2,anchor:[0,0],symbolType:"arrow2Left",angle:a,dx:n[0],dy:n[1],size:z,zIndex:-9},"symbol");i.isEmpty(u?.panel)||(e.states=u.panel);const s=_.createOrUpdateChild("poptip-rect-panel",{...H,visible:I&&(k||m),x:0,y:0,width:C,height:P,zIndex:-8},"rect");i.isEmpty(u?.panel)||(s.states=u.panel)}if(_.setAttributes({x:-n[0]+p,y:-n[1]+b}),!N||!D)break;{const e=this.AABBBounds,s=(new i.Bounds).setValue(0,0,D[0],D[1]);if(i.rectInsideAnotherRect(e,s,!1))break;{const a=i.getRectIntersect(e,s,!1),n=(a.x2-a.x1)*(a.y2-a.y1);n<$&&($=n,O=t)}}}}positionList=["top","tl","tr","bottom","bl","br","left","lt","lb","right","rt","rb"];getAngleAndOffset(t,e,s,a){const n=a[1]/2;switch(t){case"tl":return{angle:i.pi/2*3,offset:[e/4,s+n],rectOffset:[-e/4,-s-a[1]]};case"top":return{angle:i.pi/2*3,offset:[e/2,s+n],rectOffset:[0,-s-a[1]]};case"tr":return{angle:i.pi/2*3,offset:[e/4*3,s+n],rectOffset:[e/4*3,-s-a[1]]};case"rt":return{angle:0,offset:[-n,s/5],rectOffset:[e/4*3,-s-a[1]]};case"right":return{angle:0,offset:[-n,s/2],rectOffset:[e/4*3,-s-a[1]]};case"rb":return{angle:0,offset:[-n,s/5*4],rectOffset:[e/4*3,-s-a[1]]};case"bl":return{angle:i.pi/2,offset:[e/4,-n],rectOffset:[-e/4,-s-a[1]]};case"bottom":return{angle:i.pi/2,offset:[e/2,-n],rectOffset:[0,-s-a[1]]};case"br":return{angle:i.pi/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-s-a[1]]};case"lt":return{angle:i.pi,offset:[e+n,s/5],rectOffset:[-e/4,-s-a[1]]};case"left":return{angle:i.pi,offset:[e+n,s/2],rectOffset:[0,-s-a[1]]};case"lb":return{angle:i.pi,offset:[e+n,s/5*4],rectOffset:[e/4*3,-s-a[1]]}}}}var L="inversify:paramtypes";function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}var M=0;var w=function(t){this.id=M++,this.registry=t};function T(){return function(t){if(Reflect.hasOwnMetadata(L,t))throw new Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(L,e,t),t}}function C(t,e,i,s){var a,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"===("undefined"==typeof Reflect?"undefined":B(Reflect))&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(r=(n<3?a(r):n>3?a(e,i,r):a(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}"function"==typeof SuppressedError&&SuppressedError;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}},I={poptip:i.merge({},P)};let H=class{render(t,e,s,a,n,r,l,o,h,d,c,u,p){if(1===t._showPoptip){const{visible:e,visibleCb:s}=t.attribute.poptip||{};if(!1===e||s&&!1===s(t))return;this.poptipComponent||(this.poptipComponent=new k(t.attribute.poptip));let a=t.attribute.poptip||{};if("text"===t.type&&null==a.title&&null==a.content){const e={};b=e,g=a,i.merge(b,I.poptip,g),a=e,a.content=a.content??t.attribute.text}const n=t.globalTransMatrix;this.poptipComponent.setAttributes({visibleAll:!0,pickable:!1,childrenPickable:!1,...a,x:n.e,y:n.f}),d.stage.tryInitInteractiveLayer();const r=d.stage.getLayer("_builtin_interactive");r&&r.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}));var b,g}};H=C([T()],H);let z=class{name="poptip";activeEvent="onRegister";pluginService;_uid=e.Generator.GenAutoIncrementId();key=this.name+this._uid;activeGraphic;activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}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)};unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))};setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};z=C([T()],z);let V=class{name="poptipForText";activeEvent="onRegister";pluginService;_uid=e.Generator.GenAutoIncrementId();key=this.name+this._uid;activeGraphic;activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}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)};unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))};setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};V=C([T()],V);const R=new w((t=>{t(H).toSelf().inSingletonScope(),t(e.InteractiveSubRenderContribution).toService(H),t(z).toSelf().inSingletonScope(),t(e.AutoEnablePlugins).toService(z),t(V).toSelf().inSingletonScope(),t(e.AutoEnablePlugins).toService(V)}));class D extends n{name="crosshair";render(){this.renderCrosshair(this)}}class N extends D{static defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};constructor(t){super(i.merge({},N.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",{points:[e,i],...s},"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}class O extends D{static defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};topLabelShape;bottomLabelShape;leftLabelShape;rightLabelShape;constructor(t){super(i.merge({},O.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",{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})}}class $ extends D{static defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};constructor(t){super(i.merge({},$.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",{...e,outerRadius:i,...this.attribute,...s},"arc")}setLocation(t){const{center:e}=this.attribute,s=i.PointService.distancePP(t,e);this.setAttribute("radius",s)}}class U extends D{static defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};constructor(t){super(i.merge({},U.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:a}=this.attribute,{startAngle:n,endAngle:r}=this.attribute;return t.createOrUpdateChild("crosshair-sector",{...e,outerRadius:i,innerRadius:s,startAngle:n,endAngle:r,...a},"arc")}setLocation(t){const{center:e,startAngle:s=y,endAngle:a=m}=this.attribute,n=a-s,r=i.radianToDegree(i.getAngleByPoint(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}class W extends D{static defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};constructor(t){super(i.merge({},W.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:s,sides:a=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:l}=this.attribute,o=(l-r)%(2*Math.PI)==0,h=(l-r)/a;let d;for(let t=0;t<=a;t++){const n=r+h*t,l=i.polarToCartesian(e,s,n);0===t?d=`M${l.x},${l.y}`:d+=`L${l.x},${l.y}`,t===a&&o&&(d+="Z")}return t.createOrUpdateChild("crosshair-polygon",{path:d,...n},"path")}setLocation(t){const{center:e}=this.attribute,s=i.PointService.distancePP(t,e);this.setAttribute("radius",s)}}const F=5,G=31,Y=32,X=new Uint32Array(Y+1),q=new Uint32Array(Y+1);q[0]=0,X[0]=~q[0];for(let t=1;t<=Y;++t)q[t]=q[t-1]<<1|1,X[t]=~q[t];function Z(t,e,i=0){const s=Math.max(1,Math.sqrt(t*e/1e6)),a=~~((t+2*i+s)/s),n=~~((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+Y)/Y));function s(t,e){i[t]|=e}function a(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const a=s*t+e;return i[a>>>F]&1<<(a&G)},set:(e,i)=>{const a=i*t+e;s(a>>>F,1<<(a&G))},clear:(e,i)=>{const s=i*t+e;a(s>>>F,~(1<<(s&G)))},getRange:({x1:s,y1:a,x2:n,y2:r})=>{if(n<0||r<0||s>t||a>e)return!0;let l,o,h,d,c=r;for(;c>=a;--c)if(l=c*t+s,o=c*t+n,h=l>>>F,d=o>>>F,h===d){if(i[h]&X[l&G]&q[1+(o&G)])return!0}else{if(i[h]&X[l&G])return!0;if(i[d]&q[1+(o&G)])return!0;for(let t=h+1;t<d;++t)if(i[t])return!0}return!1},setRange:({x1:i,y1:a,x2:n,y2:r})=>{if(n<0||r<0||i>t||a>e)return;let l,o,h,d,c;for(;a<=r;++a)if(l=a*t+i,o=a*t+n,h=l>>>F,d=o>>>F,h===d)s(h,X[l&G]&q[1+(o&G)]);else for(s(h,X[l&G]),s(d,q[1+(o&G)]),c=h+1;c<d;++c)s(c,4294967295)},clearRange:({x1:e,y1:i,x2:s,y2:n})=>{let r,l,o,h,d;for(;i<=n;++i)if(r=i*t+e,l=i*t+s,o=r>>>F,h=l>>>F,o===h)a(o,q[r&G]|X[1+(l&G)]);else for(a(o,q[r&G]),a(h,X[1+(l&G)]),d=o+1;d<h;++d)a(d,0)},outOfBounds:({x1:i,y1:s,x2:a,y2:n})=>i<0||s<0||n>=e||a>=t,toImageData:s=>{const a=s.createImageData(t,e),n=a.data;for(let s=0;s<e;++s)for(let e=0;e<t;++e){const a=s*t+e,r=4*a,l=i[a>>>F]&1<<(a&G);n[r+0]=255*l,n[r+1]=255*l,n[r+2]=255*l,n[r+3]=31}return a}}}(a,n),r.ratio=s,r.padding=i,r.width=t,r.height=e,r}function j(t,e,s=!1){if(s){const{x1:s,x2:a,y1:n,y2:r}=e,l=i.clamp(s,0,t.width),o=i.clamp(a,0,t.width),h=i.clamp(n,0,t.height),d=i.clamp(r,0,t.height);return{x1:t(l),x2:t(o),y1:t(h),y2:t(d)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function J(t,e,i,s=!0){const a=j(t,i);return!(s&&e.outOfBounds(a))&&!e.getRange(a)}function K(t,e){return!(!t||!e)&&e.encloses(t)}function Q(t,e,i,s=[],a=!0){for(let n=0;n<s.length;n++){const r=i.clone();if(r.setAttributes(s[n]),r.update(),J(t,e,j(t,r.AABBBounds),a))return e.setRange(j(t,r.AABBBounds,!0)),s[n]}return!1}function tt(t,e,s,a,n,r,l){if("bound"===s.type||"position"===s.type){if(i.isFunction(l)){const o=((i.isFunction(s.position)?s.position(n.attribute):s.position)||function(t){if("rect"===t)return it;return et}(a.type)).map((t=>l(n.AABBBounds,r,t,a.offset)));return Q(t,e,n,o,a.overlap?.clampForce)}return!1}if("moveY"===s.type){const r=(s.offset?i.isFunction(s.offset)?s.offset(n.attribute):s.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return Q(t,e,n,r,a.overlap?.clampForce)}if("moveX"===s.type){const r=(s.offset?i.isFunction(s.offset)?s.offset(n.attribute):s.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return Q(t,e,n,r,a.overlap?.clampForce)}return!1}const et=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],it=["top","inside-top","inside"];function st(t,e,i){const{x1:s,x2:a,y1:n,y2:r}=t.AABBBounds,l=Math.min(s,a),o=Math.max(s,a),h=Math.min(n,r),d=Math.max(n,r);let c=0,u=0;return l<0&&o-l<=e?c=-l:o>e&&l-(o-e)>=0&&(c=e-o),h<0&&d-h<=i?u=-h:d>i&&h-(d-i)>=0&&(u=i-d),{dx:c,dy:u}}const at={fadeIn:(t={})=>({from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:t.opacity??1,fillOpacity:t.fillOpacity??1,strokeOpacity:t.strokeOpacity??1}}),fadeOut:(t={})=>({from:{opacity:t.opacity??1,fillOpacity:t.fillOpacity??1,strokeOpacity:t.strokeOpacity??1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}})};function nt(t,e){return at[e]?.(t)??{from:{},to:{}}}const rt="same-time",lt=300,ot="linear";class ht extends n{name="label";_baseMarks;_bitmap;setBitmap(t){this._bitmap=t}_bmpTool;setBitmapTool(t){this._bmpTool=t}_graphicToText;_idToGraphic;onAfterLabelOverlap;_lastHover;_lastSelect;_enableAnimation;layoutArcLabels(t,e,i,s,a){return[]}render(){this._prepare();const{overlap:t,smartInvert:e,dataFilter:s,customLayoutFunc:a,customOverlapFunc:n}=this.attribute;let r,l=this.attribute.data;i.isFunction(s)&&(l=s(l)),i.isFunction(a)?r=a(l,(t=>this._idToGraphic.get(t.id))):(r=this.layout(l),i.isFunction(n)?r=n(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)}_onHover=t=>{const e=t.target;e===this._lastHover||i.isEmpty(e.states)||(e.addState(f.hover,!0),l(this,(t=>{t===e||i.isEmpty(t.states)||t.addState(f.hoverReverse,!0)})),this._lastHover=e)};_onUnHover=t=>{this._lastHover&&(l(this,(t=>{i.isEmpty(t.states)||(t.removeState(f.hoverReverse),t.removeState(f.hover))})),this._lastHover=null)};_onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void l(this,(t=>{i.isEmpty(t.states)||(t.removeState(f.selectedReverse),t.removeState(f.selected))}));i.isEmpty(e.states)||(e.addState(f.selected,!0),l(this,(t=>{t===e||i.isEmpty(t.states)||t.addState(f.selectedReverse,!0)})),this._lastSelect=e)};_createLabelText(t){const i=e.createText(t);return this._bindEvent(i),this._setStates(i),i}_prepare(){const t=function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),e=[];if(t.forEach((t=>{"willRelease"!==t.releaseStatus&&e.push(t)})),this._idToGraphic?.clear(),this._baseMarks=e,!e||0===e.length)return;const{data:s}=this.attribute;if(s&&0!==s.length){this._idToGraphic||(this._idToGraphic=new Map);for(let t=0;t<e.length;t++){const a=s[t],n=e[t];a&&n&&(i.isValid(a.id)||(a.id=`vrender-component-${this.name}-${t}`),this._idToGraphic.set(a.id,n))}}}layout(t=[]){const{textStyle:e={},position:s,offset:a}=this.attribute,n=[],r=[];for(let l=0;l<t.length;l++){const o=t[l],h=this._idToGraphic.get(o.id),d={fill:h.attribute.fill,...e,...o},c=this._createLabelText(d),u=this.getGraphicBounds(c);r.push(u);const p=this.getGraphicBounds(h,{x:o.x,y:o.y}),b=this.labeling(u,p,i.isFunction(s)?s(o):s,a);b&&(d.x=b.x,d.y=b.y,c.setAttributes(b),n.push(c))}if("arc"===this.attribute.type){const e=this.layoutArcLabels(s,this.attribute,Array.from(this._idToGraphic.values()),t,r);for(let i=0;i<t.length;i++){const s=t[i],a=e.find((t=>t.labelText===s.text)),r={x:a.labelPosition.x,y:a.labelPosition.y,angle:this.attribute.angle??a.angle,labelLinePath:a.labelLinePath};n[i].setAttributes(r)}}return n}_overlapping(t){if(0===t.length)return[];const e=this.attribute.overlap,s=[],a=this.getBaseMarkGroup(),n=e.size??{width:a?.AABBBounds.width()??0,height:a?.AABBBounds.height()??0};if(0===n.width||0===n.height)return t;const{avoidBaseMark:r,strategy:l=[],hideOnHit:o=!0,clampForce:h=!0,avoidMarks:d=[]}=e,c=this._bmpTool||Z(n.width,n.height),u=this._bitmap||c.bitmap(),p=l.some((t=>"bound"===t.type));r&&this._baseMarks?.forEach((t=>{t.AABBBounds&&u.setRange(j(c,t.AABBBounds,!0))})),d.length>0&&d.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&&u.setRange(j(c,t.AABBBounds,!0))})):t.AABBBounds&&u.setRange(j(c,t.AABBBounds,!0))}));for(let e=0;e<t.length;e++){if(!1===t[e].visible)continue;const i=t[e],a=this._idToGraphic.get(i.attribute.id);if(i.update(),J(c,u,i.AABBBounds,h)){if(!p){u.setRange(j(c,i.AABBBounds,!0)),s.push(i);continue}if(p&&a?.AABBBounds&&K(i.AABBBounds,a?.AABBBounds)){u.setRange(j(c,i.AABBBounds,!0)),s.push(i);continue}}if(h){const{dx:t=0,dy:e=0}=st(i,c.width,c.height);if((0!==t||0!==e)&&J(c,u,{x1:i.AABBBounds.x1+t,x2:i.AABBBounds.x2+t,y1:i.AABBBounds.y1+e,y2:i.AABBBounds.y2+e})){i.setAttributes({x:i.attribute.x+t,y:i.attribute.y+e}),s.push(i);continue}}let n=!1;for(let r=0;r<l.length;r++)if(n=tt(c,u,l[r],this.attribute,i,this.getGraphicBounds(a,t[e]),this.labeling),!1!==n){i.setAttributes({x:n.x,y:n.y}),s.push(i);break}if(!n&&h){const{dx:t=0,dy:e=0}=st(i,c.width,c.height);if((0!==t||0!==e)&&J(c,u,{x1:i.AABBBounds.x1+t,x2:i.AABBBounds.x2+t,y1:i.AABBBounds.y1+e,y2:i.AABBBounds.y2+e})){i.setAttributes({x:i.attribute.x+t,y:i.attribute.y+e}),u.setRange(j(c,i.AABBBounds,!0)),s.push(i);continue}}!n&&!o&&s.push(i)}return i.isFunction(this.onAfterLabelOverlap)&&this.onAfterLabelOverlap(u),s}getBaseMarkGroup(){const{baseMarkGroupName:t}=this.attribute;if(t)return this.getRootNode().find((e=>e.name===t),!0)}getGraphicBounds(t,e={}){return t?.AABBBounds||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){const s=this.attribute.animation??{},a=!1===this._enableAnimation||!1===s,n=s.mode??rt,r=s.duration??lt,l=s.easing??ot,o=s.delay??0,h=new Map,d=this._graphicToText||new Map,c=[];t.forEach(((t,u)=>{const p=t.attribute?.labelLinePath?e.createPath({visible:t.attribute?.visible??!0,stroke:t.attribute?.line?.stroke??t.attribute?.fill,lineWidth:1,path:t.attribute?.labelLinePath}):void 0,b=this._idToGraphic.get(t.attribute.id),g=d?.get(b)?"update":"enter";if("enter"===g)if(c.push(t),h.set(b,t),!a&&b){const{from:e,to:i}=nt(t.attribute,"fadeIn");this.add(t),p&&this.add(p),b.onAnimateBind=()=>{t.setAttributes(e);const s=this._afterRelatedGraphicAttributeUpdate(t,c,u,b,{mode:n,duration:r,easing:l,to:i,delay:o});b.on("afterAttributeUpdate",s)}}else this.add(t),p&&this.add(p);if("update"===g){const n=d.get(b);d.delete(b),h.set(b,n),a?n.setAttributes(t.attribute):(n.animate().to(t.attribute,r,l),!1!==s.increaseEffect&&n.attribute.text!==t.attribute.text&&i.isValidNumber(Number(n.attribute.text)*Number(t.attribute.text))&&n.animate().play(new e.IncreaseCount({text:n.attribute.text},{text:t.attribute.text},r,l)))}})),d.forEach((t=>{a?this.removeChild(t):t?.animate().to(nt(t.attribute,"fadeOut").to,r,l).onEnd((()=>{this.removeChild(t)}))})),this._graphicToText=h}_afterRelatedGraphicAttributeUpdate(t,i,s,a,{mode:n,duration:r,easing:l,to:o,delay:h}){const d=c=>{const{detail:u}=c;if(!u)return{};if(!(u&&u.type===e.AttributeUpdateType.ANIMATE_UPDATE&&u.animationState&&"wait"!==u.animationState.step?.type))return{};if(u.type===e.AttributeUpdateType.ANIMATE_END)return void t.setAttributes(o);const p=()=>{a&&(a.onAnimateBind=void 0,a.removeEventListener("afterAttributeUpdate",d))};switch(n){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(o,r,l);break;case"after-all":s===i.length-1&&u.animationState.end&&i.forEach((t=>{t.animate({onEnd:p}).wait(h).to(o,r,l)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(o,r,l)}};return d}_smartInvert(t){const e=this.attribute.smartInvert||{},{textType:i,contrastRatiosThreshold:s,alternativeColors:a}=e;for(let e=0;e<t.length;e++){const n=t[e];if(!n)continue;const r=this._idToGraphic.get(n.attribute.id);let l=K(n.AABBBounds,r?.AABBBounds);if("arc"===this.attribute.type&&(l="inside"===this.attribute.position),n.attribute.stroke&&n.attribute.lineWidth>0)n.setAttributes({fill:d(n.attribute.fill,n.attribute.stroke,i,s,a)});else if(l){const t=r.attribute.fill,e=n.attribute.fill;n.setAttributes({fill:d(e,t,i,s,a)})}else if(n.attribute.lineWidth>0){const t=n.attribute.stroke,e=n.attribute.fill;n.setAttributes({stroke:r.attribute.fill,fill:d(e,t,i,s,a)})}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class dt extends ht{name="symbol-label";static defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};constructor(t){super(i.merge({},dt.defaultAttributes,t))}labeling(t,e,i="top",s=0){if(!t)return;const{x1:a,y1:n,x2:r,y2:l}=t,o=Math.abs(r-a),h=Math.abs(l-n),d=(e.x1+e.x2)/2,c=(e.y1+e.y2)/2;let u=0,p=0,b=0,g=0;e&&(b=Math.abs(e.x1-e.x2)/2,g=Math.abs(e.y1-e.y2)/2);const _={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(_[i]*(Math.PI/180)),p=Math.cos(_[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:d+u*(s+b)+Math.sign(u)*(o/2),y:c+p*(s+g)+Math.sign(p)*(h/2)}}}class ct extends ht{static tag="rect-label";static defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};constructor(t){super(i.merge({},ct.defaultAttributes,t))}labeling(t,e,i="top",s=0){if(!t||!e)return;const{x1:a,y1:n,x2:r,y2:l}=t,o=Math.abs(r-a),h=Math.abs(l-n),d=Math.abs(e.x2-e.x1),c=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,b=0,g=0;switch(i){case"top":case"inside-top":g=-.5;break;case"bottom":case"inside-bottom":g=.5;break;case"left":case"inside-left":b=-.5;break;case"right":case"inside-right":b=.5}u+=b*d,p+=g*c;let _=0,y=0;const m=i.includes("inside");i.includes("top")?y=m?1:-1:i.includes("bottom")?y=m?-1:1:i.includes("left")?_=m?1:-1:i.includes("right")&&(_=m?-1:1);return{x:u+_*s+_*o/2,y:p+y*s+y*h/2}}}class ut extends ht{name="line-label";static defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"end",offset:6,pickable:!1};constructor(t){super(i.merge({},ut.defaultAttributes,t))}getGraphicBounds(t,e={}){if("line"!==t.type)return super.getGraphicBounds(t,e);const{position:i="end"}=this.attribute,s=t?.attribute?.points||[e],a="start"===i?0:s.length-1;return{x1:s[a].x,x2:s[a].x,y1:s[a].y,y2:s[a].y}}labeling(t,e,i="end",s=0){if(!t||!e)return;const{x1:a,x2:n}=t,r=Math.abs(n-a),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 pt(t,e,i,s){const a=(n={radius:i,angle:s}).radius?{x:Math.cos(n.angle)*n.radius,y:Math.sin(n.angle)*n.radius}:{x:0,y:0};var n;return{x:t+a.x,y:e+a.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 _t(t,e){const{x1:i,y1:s,x2:a,y2:n}=t,{x1:r,y1:l,x2:o,y2:h}=e;return!(i<=r&&a<=r||i>=o&&a>=o||s<=l&&n<=l||s>=h&&n>=h)}class yt{key;refDatum;center;outerCenter;labelSize;labelPosition;labelLimit;labelVisible;lastLabelY;labelYRange;labelText;pointA;pointB;pointC;labelLinePath;quadrant;radian;middleAngle;k;textAlign;textBaseline;angle;constructor(t,e,i,s,a,n){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=a,this.middleAngle=n,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 ht{name="arc-label";static 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}};_ellipsisWidth=0;_arcLeft=new Map;_arcRight=new Map;constructor(t){super(i.merge({},mt.defaultAttributes,t))}_overlapping(t){return t}labeling(t,e,i="outside",s=0){if(t&&e)return{x:0,y:0}}layoutArcLabels(t,e,i,s,a){this._arcLeft.clear(),this._arcRight.clear();const{width:n,height:r}=e;i.forEach(((t,i)=>{const l=t.attribute,o=this.computeLayoutOuterRadius(l.outerRadius,n,r),h=this.computeRadius(o,n,r),d={x:l?.x??0,y:l?.y??0},c=s[i],u=a[i],p=(l.startAngle+l.endAngle)/2,b=l.endAngle-l.startAngle,g=bt(l.endAngle-b/2),_=pt(d.x,d.y,l.outerRadius,p),y=pt(d.x,d.y,h+e.line.line1MinLength,p),m=new yt(c,_,y,g,b,p);var x;m.pointA=pt(d.x,d.y,this.computeDatumRadius(2*d.x,2*d.y,l.outerRadius),m.middleAngle),m.labelSize={width:u.x2-u.x1,height:u.y2-u.y1},1===(x=m.quadrant)||2===x?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()),h=[];return"inside"===t?(h.push(...this._layoutInsideLabels(o,e,i)),h.push(...this._layoutInsideLabels(l,e,i))):(h.push(...this._layoutOutsideLabels(o,e,i)),h.push(...this._layoutOutsideLabels(l,e,i))),h}_layoutInsideLabels(t,e,s){const a={x:s[0].attribute?.x??0,y:s[0].attribute?.y??0},n=this.computeLayoutOuterRadius(s[0].attribute.innerRadius,e.width,e.height),r=this.computeLayoutOuterRadius(s[0].attribute.outerRadius,e.width,e.height),l=e,o=l.spaceWidth;return t.forEach((t=>{const{labelSize:s,radian:h}=t,d=this.computeRadius(n,e.width,e.height,1),c=this.computeRadius(r,e.width,e.height,1),u=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(c,s.height);let p;if(h<u)p=0;else{let t;t=h>=Math.PI?d:Math.max(d,s.height/2/Math.tan(h/2)),p=c-t-o}!0!==l?.rotate&&(p=c-o);const b=this._getFormatLabelText(t.refDatum,p);t.labelText=b;const g=Math.min(p,t.labelSize.width),_=this._computeAlign(t,e),y=c-o-("left"===_?g:"right"===_?0:g/2);t.labelPosition=pt(a.x,a.y,y,t.middleAngle),t.labelLimit=g,i.isGreater(g,0)||(t.labelVisible=!1),t.angle=t.middleAngle})),t}_layoutOutsideLabels(t,e,s){const a=s[0].attribute?.x??0,n=2*(s[0].attribute?.y??0),r=e.line.line2MinLength,l=e.layout,o=e.spaceWidth;if(t.forEach((t=>{const e=gt(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+r+o),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const i of t){const{labelPosition:t,labelSize:a}=i;i.labelLimit=a.width,i.pointB=gt(i.quadrant)?{x:t.x+a.width/2+r+o,y:t.y}:{x:t.x-a.width/2-r-o,y:t.y},this._computeX(i,e,s)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const i=n/(e.textStyle?.fontSize||16);this._adjustY(t,i,e,s);const{minY:a,maxY:r}=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(n,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(n/2-a),Math.abs(r-n/2)),o=this._computeLayoutRadius(l,e,s);for(const i of t)this._computePointB(i,o,e,s),this._computeX(i,e,s)}const h=2*a;return t.forEach((t=>{t.labelVisible&&(i.isLess(t.pointB.x,r+o)||i.isGreater(t.pointB.x,h-r-o))&&(t.labelVisible=!1),t.angle=0,t.labelLinePath=`M${Math.round(t.pointA.x)},${Math.round(t.pointA.y)} L${Math.round(t.pointB.x)},${Math.round(t.pointB.y)} L${Math.round(t.pointC.x)},${Math.round(t.pointC.y)}`})),t}_computeX(t,e,s){const a=s[0].attribute?.x??0,n=2*a,r=(s[0].attribute?.y,this.computeLayoutOuterRadius(s[0].attribute.outerRadius,e.width,e.height)),l=e.line.line1MinLength,o=e.line.line2MinLength,h=e.layout?.align,d=e.spaceWidth;this._computeAlign(t,e);const{labelPosition:c,quadrant:u,pointB:p}=t;i.isValidNumber(p.x*p.y)||(t.pointC={x:NaN,y:NaN},c.x=NaN,t.labelLimit=0);const b=this.computeRadius(r,e.width,e.height),g=gt(u)?-1:1;let _=0;let y=(g>0?n-p.x:p.x)-o-d;"labelLine"===h&&(_=(b+l+o)*g+a,y=(g>0?n-_:_)-d);const m=this._getFormatLabelText(t.refDatum,y);t.labelText=m;let x=Math.min(y,t.labelSize.width);switch(h){case"labelLine":break;case"edge":_=g>0?n-x-d:x+d;break;default:_=p.x+g*o}if(x=Math.max(this._ellipsisWidth,x),t.pointC={x:_,y:c.y},"edge"===h){const t=0;c.x=g>0?n+t:t}else{const e=0;c.x=_+e+g*(d+.5*t.labelSize.width)}t.labelLimit=x}_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){const s=e,a=s.textStyle?.textAlign??s.textStyle?.align,n=s.layout?.textAlign??s.layout?.align;return"inside"!==s.position?i.isNil(a)||"auto"===a?"edge"===n?gt(t.quadrant)?"left":"right":gt(t.quadrant)?"right":"left":a:i.isNil(a)||"auto"===a?"center":a}_getFormatLabelText(t,e){return t.text}_adjustY(t,e,s,a){a[0].attribute?.x;const n=2*(a[0].attribute?.y??0),r=s.layout;if("vertical"===r.strategy){let e,s=0;const a=t.length;if(a<=0)return;for(let n=0;n<a;n++){const{y1:r}=t[n].getLabelBounds();if(e=r-s,i.isLess(e,0)){const i=this._shiftY(t,n,a-1,-e);this._shiftY(t,i,0,e/2)}const{y2:l}=t[n].getLabelBounds();s=l}const{y1:r}=t[0].getLabelBounds();e=r-0,i.isLess(e,0)&&this._shiftY(t,0,a-1,-e);for(let e=t.length-1;e>=0&&t[e].getLabelBounds().y2>n;e--)t[e].labelVisible=!1}else if("none"!==r.strategy){const l=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));l.sort(((t,e)=>e.arc.radian-t.arc.radian)),l.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,h=-1/0;for(let d=0;d<e&&d<t.length;d++){this._storeY(t);const e=l[d].arc;this._computeYRange(e,s,a),e.labelVisible=!0;const c=e.labelPosition.y,{lastIndex:u,nextIndex:p}=this._findNeighborIndex(t,l[d]),b=t[u],g=t[p];if(-1===u&&-1!==p){const i=g.labelPosition.y;c>i?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,p)}else if(-1!==u&&-1===p){const i=b.labelPosition.y;c<i?e.labelPosition.y=i+b.labelSize.height/2+e.labelSize.height/2:this._twoWayShift(t,b,e,l[d].originIndex)}else if(-1!==u&&-1!==p){const i=b.labelPosition.y,s=g.labelPosition.y;c>s?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,b,e,l[d].originIndex)):c<i?(e.labelPosition.y=i+b.labelSize.height/2+e.labelSize.height/2,this._twoWayShift(t,e,g,p)):(this._twoWayShift(t,b,e,l[d].originIndex),this._twoWayShift(t,e,g,p))}const _=Math.min(o,l[d].originIndex),y=Math.max(h,l[d].originIndex);let m;if(m=t[y].getLabelBounds().y2-n,i.isGreater(m,0)&&this._shiftY(t,y,0,-m),m=t[_].getLabelBounds().y1-0,i.isLess(m,0)&&this._shiftY(t,_,t.length-1,-m),m=t[y].getLabelBounds().y2-n,i.isGreater(m,0)){e.labelVisible=!1,this._restoreY(t);break}r.tangentConstraint&&!this._checkYRange(t)?(e.labelVisible=!1,this._restoreY(t)):(o=_,h=y)}}}_shiftY(t,e,i,s){const a=e<i?1:-1;let n=e;for(;-1!==n;){t[n].labelPosition.y+=s;const e=this._findNextVisibleIndex(t,n,i,a);if(e>=0&&e<t.length){const{y1:i,y2:s}=t[n].getLabelBounds(),{y1:r,y2:l}=t[e].getLabelBounds();if(a>0&&s<r||a<0&&i>l)return n}n=e}return i}_findNextVisibleIndex(t,e,i,s){const a=(i-e)*s;for(let i=1;i<=a;i++){const a=e+i*s;if(t[a].labelVisible)return a}return-1}_computePointB(t,e,s,a){const n=s,r=this.computeLayoutOuterRadius(a[0].attribute.outerRadius,s.width,s.height),l=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const n={x:a[0].attribute?.x??0,y:a[0].attribute?.y??0},o=this.computeRadius(r,s.width,s.height),{labelPosition:h,quadrant:d}=t,c=e-Math.max(o+l,a[0].attribute.outerRadius),u=Math.sqrt(e**2-Math.abs(n.y-h.y)**2)-c;i.isValidNumber(u)?t.pointB={x:n.x+u*(gt(d)?-1:1),y:h.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 a={width:2*(s[0].attribute?.x??0),height:2*(s[0].attribute?.y??0)},n=this.computeLayoutOuterRadius(s[0].attribute.outerRadius,e.width,e.height),r=e.line.line1MinLength,{width:l,height:o}=a,h=this.computeRadius(n,e.width,e.height),d=this._computeLayoutRadius(o/2,e,s),c=Math.abs(t.center.x-l/2),u=t.center.y-o/2;let p,b,g;if(i.isNumberClose(l/2,c))p=0,b=1,g=-u;else if(i.isNumberClose(o/2,u))p=1,b=0,g=-c;else{const t=-1/(u/c);p=t,b=-1,g=u-t*c}const _=function(t,e,i,s,a,n){if(0===t&&0===e||n<=0)return[];if(0===t){const t=-i/e,r=n**2-(t-a)**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=n**2-(e-s)**2;return r<0?[]:0===r?[{x:e,y:a}]:[{x:e,y:Math.sqrt(r)+a},{x:e,y:-Math.sqrt(r)+a}]}const r=(e/t)**2+1,l=2*((i/t+s)*(e/t)-a),o=l**2-4*r*((i/t+s)**2+a**2-n**2);if(o<0)return[];const h=(-l+Math.sqrt(o))/(2*r),d=(-l-Math.sqrt(o))/(2*r),c=-(e*h+i)/t;return 0===o?[{x:c,y:h}]:[{x:c,y:h},{x:-(e*d+i)/t,y:d}]}(p,b,g,r+h-d,0,d);if(_.length<2)return;let y,m;_[0].x>_[1].x&&_.reverse(),_[0].x<0?i.isNumberClose(_[0].y,_[1].y)?Math.abs(t.middleAngle)<Math.PI/2?(y=0,m=_[1].y+o/2):(y=_[1].y+o/2,m=o):_[0].y<_[1].y?(y=0,m=_[1].y+o/2):(y=_[1].y+o/2,m=a.height):(y=Math.min(_[0].y,_[1].y)+o/2,m=Math.max(_[0].y,_[1].y)+o/2),t.labelYRange=[y,m]}_computeLayoutRadius(t,e,i){const s=e,a=s.layoutArcGap,n=s.line.line1MinLength,r=this.computeLayoutOuterRadius(i[0].attribute.outerRadius,e.width,e.height),l=this.computeRadius(r,e.width,e.height)+n,o=l-a;return Math.max((o**2+t**2)/(2*o),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,a=-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){a=e;break}return{lastIndex:s,nextIndex:a}}_twoWayShift(t,e,s,a){const n=s.getLabelBounds().y1-e.getLabelBounds().y2;if(i.isLess(n,0)){const e=this._shiftY(t,a,t.length-1,-n);this._shiftY(t,e,0,n/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();_t(e,s)?t[i].labelVisible=!1:e=s}}computeRadius(t,e,s,a){return this.computeLayoutRadius(e||0,s||0)*t*(i.isNil(a)?1:a)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}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}}const xt={rect:ct,symbol:dt,arc:mt};class ft extends n{name="data-label";_componentMap;static defaultAttributes={pickable:!1};constructor(t){super(i.merge({},ft.defaultAttributes,t))}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:s=0,height:a=0}=e||{};if(!s||!a||!i.isValidNumber(a*s))return;this._componentMap||(this._componentMap=new Map);const n=Z(s,a),r=n.bitmap(),l=new Map,o=this._componentMap;for(let e=0;e<t.length;e++){const i=t[e];if(xt[i.type]){const{baseMarkGroupName:t}=i;let e=this._componentMap.get(t);e?(e.setBitmapTool(n),e.setBitmap(r),e.setAttributes(i),l.set(t,e)):(e=new xt[i.type](i),e.setBitmap(r),e.setBitmapTool(n),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()}))}}function vt(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 At(t,e,s,a){let n="";if(!t||0===e.length)return n;const r=e[0],l=i.PointService.distancePP(t,r),o=s?0:1;return a?n+=`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?n=`M${t.x},${t.y}`:n+=`A${l},${l},0,0,${o},${t.x},${t.y}`})),n}function St(t,e,s){const{type:a,closed:n}=s,r=e.slice(0).reverse();let l="",o="";if("line"===a&&s.smoothLink&&s.center){const e=t[0],a=r[0],h=s.center;l=vt(t,!!n),o=vt(r,!!n);const d=i.PointService.distancePP(a,h),c=i.PointService.distancePP(e,h);l+=`A${d},${d},0,0,1,${a.x},${a.y}L${a.x},${a.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===a){const{center:e}=s;l=At(e,t,!1,!!n),o=At(e,r,!0,!!n)}else"line"!==a&&"polygon"!==a||(l=vt(t,!!n),o=vt(r,!!n));return n?l+=o:(o="L"+o.substring(1),l+=o,l+="Z"),l}class Et extends n{name="grid";static defaultAttributes={style:{lineWidth:1,stroke:"#416180"},zIndex:0};constructor(t){super(i.merge({},Et.defaultAttributes,t))}render(){this.removeAllChild();const{type:t,items:s,style:a,closed:n,alternateColor:r,depth:l=0}=this.attribute;if(!i.isEmpty(s)&&(s.forEach(((s,r)=>{const{id:o,points:h}=s;let d="";if("line"===t||"polygon"===t)d=vt(h,!!n);else if("circle"===t){const{center:t}=this.attribute;d=At(t,h,!1,!!n)}const c=e.createPath({path:d,z:l,...i.isFunction(a)?i.merge({},Et.defaultAttributes.style,a(s,r)):a});c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${o}`),this.add(c)})),l&&"line"===t&&s.forEach(((t,s)=>{const{id:r,points:o}=t,h=[];h.push(o[0]);const d=o[1].x-o[0].x,c=o[1].y-o[0].y,u=Math.sqrt(d*d+c*c),p=l/u;h.push({x:o[0].x+d*p,y:o[0].y+c*p});const b=vt(h,!!n),g=i.abs(h[0].x-h[1].x),_=i.abs(h[0].y-h[1].y),y=e.createPath({path:b,z:0,alpha:g>_?(o[1].x-o[0].x>0?-1:1)*i.pi/2:0,beta:g<_?-i.pi/2:0,anchor3d:g>_?[h[0].x,0]:[0,h[0].y],...i.isFunction(a)?i.merge({},Et.defaultAttributes.style,a(t,s)):a});y.name=`${this.name}-line`,y.id=this._getNodeId(`path-${r}`),this.add(y)})),s.length>1&&r)){const t=i.isArray(r)?r:[r,"transparent"],a=e=>t[e%t.length];for(let t=0;t<s.length-1;t++){const[i,n]=[s[t].points,s[t+1].points],r=St(i,n,this.attribute),l=e.createPath({path:r,fill:a(t)});l.name=`${this.name}-region`,l.id=this._getNodeId(`region-${t}`),this.add(l)}}}_getNodeId(t){return`${this.id}-${t}`}}class kt extends n{name="segment";line;startSymbol;endSymbol;_startAngle;_endAngle;static 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}}};constructor(t){super(i.merge({},kt.defaultAttributes,t))}computeLineAngle(){const{points:t}=this.attribute,e=t[0],i=t[1],s=t[t.length-2],a=t[t.length-1],n=[e.x-i.x,e.y-i.y],r=Math.atan2(n[1],n[0]),l=[a.x-s.x,a.y-s.y],o=Math.atan2(l[1],l[0]);this._startAngle=r,this._endAngle=o}render(){this.removeAllChild();const{points:t,startSymbol:s,endSymbol:a,lineStyle:n,state:r,visible:l=!0}=this.attribute;if(!l)return;t.length>1&&this.computeLineAngle();const o=this.renderSymbol(s,"start"),h=this.renderSymbol(a,"end");this.startSymbol=o,this.endSymbol=h;let d=t;if(s?.visible){const e=s?.clip?s?.size||10:0;d=[{x:t[0].x-e/2*(Math.cos(this._startAngle)||0),y:t[0].y-e/2*(Math.sin(this._startAngle)||0)},...d.slice(1)]}if(a?.visible){const e=a?.clip?a?.size||10:0,i={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)};d=[...d.slice(0,d.length-1),i]}const c=e.createLine({points:d,fill:!1,...n});c.name="line",c.id=this._getNodeId("line"),i.isEmpty(r?.line)||(c.states=r.line),this.line=c,this.add(c)}renderSymbol(t,s){const{autoRotate:a=!0}=t;let n;if(t?.visible){const r=this._startAngle,l=this._endAngle,{points:o,state:h}=this.attribute,d=o[0],c=o[o.length-1],{refX:u=0,refY:p=0,refAngle:b=0,style:g,symbolType:_,size:y=12}=t;let m,x;"start"===s?(m={x:d.x+(r?u*Math.cos(r)+p*Math.cos(r-Math.PI/2):0),y:d.y+(r?u*Math.sin(r)+p*Math.sin(r-Math.PI/2):0)},x=r+Math.PI/2):(m={x:c.x+(l?u*Math.cos(l)+p*Math.cos(l-Math.PI/2):0),y:c.y+(l?u*Math.sin(l)+p*Math.sin(l-Math.PI/2):0)},x=l+Math.PI/2),n=e.createSymbol({...m,symbolType:_,size:y,angle:a?x+b:0,strokeBoundsBuffer:0,...g}),n.name=`${s}-symbol`,n.id=this._getNodeId(`${s}-symbol`),i.isEmpty(h?.symbol)||(n.states=h.symbol),this.add(n)}return n}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var Lt,Bt;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,(Bt=t.AxisStateValue||(t.AxisStateValue={})).selected="selected",Bt.selectedReverse="selected_reverse",Bt.hover="hover",Bt.hoverReverse="hover_reverse";const Mt={[t.AxisStateValue.selectedReverse]:{},[t.AxisStateValue.selected]:{},[t.AxisStateValue.hover]:{},[t.AxisStateValue.hoverReverse]:{}},wt={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}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class Tt extends n{name="axis";_innerView;getInnerView(){return this._innerView}_prevInnerView;getPrevInnerView(){return this._prevInnerView}data=[];tickLineItems=[];subTickLineItems=[];axisLabelLayerSize={};axisLabelsContainer=null;axisContainer;_lastHover;_lastSelect;getBoundsWithoutRender(t){const s=i.cloneDeep(this.attribute);i.merge(this.attribute,t);const a=e.createGroup({x:this.attribute.x,y:this.attribute.y});return this.add(a),this._renderInner(a),this.removeChild(a),this.attribute=s,a.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)}_onHover=t=>{const e=t.target;e!==this._lastHover&&e.name&&!i.isEmpty(e.states)&&(e.addState(f.hover,!0),l(this.axisContainer,(t=>{t!==e&&t.name&&!i.isEmpty(t.states)&&t.addState(f.hoverReverse,!0)})),this._lastHover=e)};_onUnHover=t=>{this._lastHover&&(l(this.axisContainer,(t=>{t.name&&!i.isEmpty(t.states)&&(t.removeState(f.hoverReverse),t.removeState(f.hover))})),this._lastHover=null)};_onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(f.selected))return this._lastSelect=null,void l(this.axisContainer,(t=>{t.name&&!i.isEmpty(t.states)&&(t.removeState(f.selectedReverse),t.removeState(f.selected))}));e.name&&!i.isEmpty(e.states)&&(e.addState(f.selected,!0),l(this.axisContainer,(t=>{t!==e&&t.name&&!i.isEmpty(t.states)&&t.addState(f.selectedReverse,!0)})),this._lastSelect=e)};_renderInner(i){const{title:s,label:a,tick:n,line:r,grid:l,items:o}=this.attribute,h=e.createGroup({x:0,y:0,zIndex:1});if(h.name=t.AXIS_ELEMENT_NAME.axisContainer,h.id=this._getNodeId("container"),h.setMode(this.mode),this.axisContainer=h,i.add(h),r?.visible&&this.renderLine(h),o&&o.length){if(this.data=this._transformItems(o[0]),n?.visible&&this.renderTicks(h),a?.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,h.add(i),o.forEach(((t,e)=>{const s=this.renderLabels(i,t,e),a=s.getChildren();this.beforeLabelsOverlap(a,t,s,e,o.length),this.handleLabelsOverlap(a,t,s,e,o.length),this.afterLabelsOverlap(a,t,s,e,o.length)}))}l?.visible&&this.renderGrid(i)}s?.visible&&this.renderTitle(h)}renderTicks(s){const a=this.getTickLineItems(),n=e.createGroup({x:0,y:0,pickable:!1});n.name=t.AXIS_ELEMENT_NAME.tickContainer,n.id=this._getNodeId("tick-container"),s.add(n),a.forEach(((s,r)=>{const l=e.createLine({...this._getTickLineAttribute("tick",s,r,a)});if(l.name=t.AXIS_ELEMENT_NAME.tick,l.id=this._getNodeId(s.id),i.isEmpty(this.attribute.tick?.state))l.states=v;else{const t=this.data[r],e=i.merge({},v,this.attribute.tick.state);Object.keys(e).forEach((s=>{i.isFunction(e[s])&&(e[s]=e[s](t.rawValue,r,t,this.data))})),l.states=e}n.add(l)})),this.tickLineItems=a;const{subTick:r}=this.attribute;if(r?.visible){const s=this.getSubTickLineItems();s.length&&s.forEach(((s,l)=>{const o=e.createLine({...this._getTickLineAttribute("subTick",s,l,a)});if(o.name=t.AXIS_ELEMENT_NAME.subTick,o.id=this._getNodeId(`${l}`),i.isEmpty(r.state))o.states=v;else{const t=i.merge({},v,r.state);Object.keys(t).forEach((e=>{i.isFunction(t[e])&&(t[e]=t[e](s.value,l,s,a))})),o.states=t}n.add(o)})),this.subTickLineItems=s}}renderLabels(s,a,n){const{dataFilter:r}=this.attribute.label;r&&i.isFunction(r)&&(a=r(a,n));const l=this._transformItems(a),o=e.createGroup({x:0,y:0,pickable:!1});o.name=`${t.AXIS_ELEMENT_NAME.labelContainer}-layer-${n}`,o.id=this._getNodeId(`label-container-layer-${n}`),s.add(o);let h=0,d=0,c="center",u="middle";return l.forEach(((s,a)=>{const r=this._getLabelAttribute(s,a,l,n),p=e.createText(r);if(p.name=t.AXIS_ELEMENT_NAME.label,p.id=this._getNodeId(`layer${n}-label-${s.id}`),i.isEmpty(this.attribute.label?.state))p.states=v;else{const t=i.merge({},v,this.attribute.label.state);Object.keys(t).forEach((e=>{i.isFunction(t[e])&&(t[e]=t[e](s,a,l,n))})),p.states=t}o.add(p);const b=r.angle??0;h=Math.max(h,p.AABBBounds.width()),d=Math.max(d,p.AABBBounds.height()),b&&(h=Math.abs(h*Math.cos(b)),d=Math.abs(d*Math.sin(b))),c=r.textAlign,u=r.textBaseline})),this.axisLabelLayerSize[n]={width:h,height:d,textAlign:c,textBaseline:u},o}renderTitle(e){const i=this.getTitleAttribute(),s=new E({...i});s.name=t.AXIS_ELEMENT_NAME.title,s.id=this._getNodeId("title"),e.add(s)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}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:a,inside:n=!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(!a){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),l=i}const h=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const a=this.getVerticalVector(r,n,e);let o=0,d=0;i.abs(a[0])>i.abs(a[1])?o=i.pi/2*(h.x>e.x?1:-1):d=i.pi/2*(h.y>e.y?-1:1),s.push({start:e,end:h,value:l,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:d})}else s.push({start:e,end:h,value:l,id:`tick-${t.id}`})})),s}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:a=2}=t,n=this.tickLineItems,r=n.length;if(r>=2)for(let t=0;t<r-1;t++){const r=n[t],l=n[t+1];for(let t=0;t<i;t++){const n=(t+1)/(i+1),o=(1-n)*r.value+n*l.value,h=this.getTickCoord(o),d=this.getVerticalCoord(h,a,s);e.push({start:h,end:d,value:o,id:`sub-tick-${o}`})}}return e}_getTickLineAttribute(t,e,s,a){let n=i.get(this.attribute,`${t}.style`);const r=this.data[s];n=i.isFunction(n)?i.merge({},i.get(wt,`${t}.style`),"tick"===t?n(r.rawValue,s,r,this.data):n(e.value,s,e,a)):n;const{start:l,end:o,anchor:h,alpha:d,beta:c}=e;return{points:[l,o],anchor:h,alpha:d,beta:c,...n}}_getLabelAttribute(t,e,s,a){const{space:n=4,inside:r=!1,formatMethod:l,...o}=this.attribute.label;let h=n,d=0;this.attribute.tick?.visible&&this.attribute.tick?.inside===r&&(d=this.attribute.tick?.length||4),this.attribute.subTick?.visible&&this.attribute.subTick?.inside===r&&(d=Math.max(d,this.attribute.subTick?.length||2)),h+=d;const c=this.getRelativeVector(t.point);a>0&&(0===c[1]?h+=(this.axisLabelLayerSize[a-1].height+i.get(this.attribute,"label.space",4))*a:h+=(this.axisLabelLayerSize[a-1].width+i.get(this.attribute,"label.space",4))*a);const u=this.getVerticalCoord(t.point,h,r),p=this.getVerticalVector(h,r,u),b=l?l(`${t.label}`,t,e,s,a):t.label;let{style:g}=o;return g=i.isFunction(g)?i.merge({},wt.label.style,g(t,e,s,a)):g,g=i.merge({textAlign:this.getTextAlign(p),textBaseline:this.getTextBaseline(p,r)},g),i.isFunction(g.text)&&(g.text=g.text({label:t.label,value:t.rawValue,index:t.index,layer:a})),{...u,text:b,lineHeight:g?.fontSize,...g}}_transformItems(t){const e=[];return t.forEach((t=>{e.push({...t,point:this.getTickCoord(t.value),id:t.id??t.label})})),e}_renderGridByType(e,i){const s=this.getGridAttribute(e),a=new Et({pickable:!1,...s,zIndex:0});a.name="subGrid"===e?`${t.AXIS_ELEMENT_NAME.grid}-sub`:`${t.AXIS_ELEMENT_NAME.grid}`,a.id=this._getNodeId(e),i.add(a)}}const Ct={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&&Pt(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Pt(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function It(t,e){for(let i,s=1,a=t.length,n=t[0].AABBBounds;s<a;n=i,++s)if(Pt(n,i=t[s].AABBBounds,e))return!0}function Ht(t){const e=t.AABBBounds;return e.width()>1&&e.height()>1}function zt(t){for(let a=1;a<t.length;a++)if(e=t[a-1],s=t[a],i.isRotateAABBIntersect(e.rotatedBounds,s.rotatedBounds,!0))return!0;var e,s;return!1}function Vt(t,e){"bottom"!==t&&"top"!==t||Dt(t,e),"left"!==t&&"right"!==t||Rt(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,a=e.centerY,n=e.angle,r=t.attribute.x,l=t.attribute.y,{x:(s-r)*Math.cos(n)+(a-l)*Math.sin(n)+r,y:(s-r)*Math.sin(n)+(l-a)*Math.cos(n)+l});var s,a,n,r,l;const o=i.x-e.centerX,h=i.y-e.centerY;e.x1+=o,e.x2+=o,e.y1+=h,e.y2+=h,e.centerX+=o,e.centerY+=h,t.rotatedBounds=e}))}(e)}function Rt(t,e){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"]),e.forEach(((t,e)=>{let a=t.attribute.angle||0;if(a<0)for(;a<0;)a+=2*Math.PI;if(a>0)for(;a>=2*Math.PI;)a-=2*Math.PI;const n=a/(.5*Math.PI);let r;r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,t.setAttributes({textAlign:i[r],textBaseline:s[r],angle:a})}))}function Dt(t,e){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"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const a=e/(.5*Math.PI);let n;n=a===Math.floor(a)?2*Math.floor(a):2*Math.floor(a)+1,t.setAttributes({textAlign:i[n],textBaseline:s[n],angle:e})}))}class Nt extends Tt{static defaultAttributes=wt;constructor(t,e){super(i.merge({},Nt.defaultAttributes,t),e),"3d"===e&&this.setMode(e)}_renderInner(s){super._renderInner(s);const{panel:a}=this.attribute;if(a&&a.visible){const s=this.axisContainer,n=s.AABBBounds,r=e.createRect({x:n.x1,y:n.y1,width:n.width(),height:n.height(),...a.style});r.name=t.AXIS_ELEMENT_NAME.background,r.id=this._getNodeId("background"),r.states=i.merge({},Mt,a.state??{}),s.insertBefore(r,s.firstChild)}}renderLine(e){const{start:s,end:a,line:n}=this.attribute,{startSymbol:r,endSymbol:l,style:o,breakRange:h,breakShape:d,breakShapeStyle:c,state:u,...p}=n,b={points:[s,a],startSymbol:r,endSymbol:l,lineStyle:o,...p};i.isEmpty(u)||(b.state={line:i.merge({},Mt,u),symbol:i.merge({},Mt,u)});const g=new kt(b);g.name=t.AXIS_ELEMENT_NAME.line,g.id=this._getNodeId("line"),e.add(g)}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(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t,e=!1){const{verticalFactor:i=1}=this.attribute,s=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 g([s[1],-1*s[0]],t*(e?1:-1)*i)}getTitleAttribute(){const{position:t="middle",space:e=4,textStyle:s={},autoRotate:a=!0,shape:n,background:r,state:l,...o}=this.attribute.title;let h=.5;"start"===t?h=0:"end"===t&&(h=1);const{verticalFactor:d=1}=this.attribute,c=-1*d,u=this.getTickCoord(h),p=this.getRelativeVector();let b=0;if(this.attribute.label?.visible&&!1===this.attribute.label?.inside){const t=+i.get(this.attribute,"label.space",4);b+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===p[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?b+=i+(e-1)*t:b=0}else{if(0===p[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?b+=i+(e-1)*t:b=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{b+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,a="center"===i,n=p[1]>0;b=1===c?n?s?b:a?b/2:t:s?t:a?b/2:b:n?s?t:a?b/2:b:s?b:a?b/2:t}}let g=0;this.attribute.tick?.visible&&!1===this.attribute.tick?.inside&&(g=this.attribute.tick?.length||4),this.attribute.subTick?.visible&&!1===this.attribute.subTick?.inside&&(g=Math.max(g,this.attribute.subTick?.length||2));const y=g+b+e,m=this.getVerticalCoord(u,y,!1),x=this.getVerticalVector(y,!1);let f,v,{angle:A}=o;if(f="start"===t?"start":"end"===t?"end":"center",i.isNil(A)&&a){A=_(p,[1,0],!0);const{verticalFactor:t=1}=this.attribute;v=1===-1*t?"bottom":"top"}else f=this.getTextAlign(x),v=this.getTextBaseline(x,!1);const S={...m,...o,textStyle:{textAlign:f,textBaseline:v,...s},state:{text:i.merge({},Mt,l?.text),shape:i.merge({},Mt,l?.shape),panel:i.merge({},Mt,l?.background)}};return S.angle=A,n&&n.visible&&(S.shape={visible:!0,...n.style},n.space&&(S.space=n.space)),r&&r.visible&&(S.panel={visible:!0,...r.style}),S}_getGridPoint(t,e){let s;if("line"===t){const{length:t}=this.attribute.grid;s=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:a,startAngle:n=y,endAngle:r=m}=this.attribute.grid;s=function(t,e,s,a,n){const r=[],l=n-a;for(let n=0;n<e;n++){const o=a+n*l/e;r.push(i.polarToCartesian(t,s,o))}return r}(t,a,i.PointService.distancePP(t,e),n,r)}return s}getGridAttribute(t){const{type:e,alignWithLabel:s=!0}=this.attribute.grid;let a=1;let n;this.data.length>=2&&(a=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((i=>{let{point:n}=i;if(!s){const t=i.value-a/2;if(this.isInValidValue(t))return;n=this.getTickCoord(t)}t.push({id:i.label,datum:i,points:this._getGridPoint(e,n)})})),r=t}else{n=i.merge({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:l=4}=this.attribute.subTick||{};if(this.data.length>=2){const i=[];this.data.forEach((t=>{let e=t.value;if(!s){const i=t.value-a/2;if(this.isInValidValue(i))return;e=i}i.push({value:e})}));for(let s=0;s<i.length-1;s++){const a=i[s],n=i[s+1];t.push({id:`sub-${s}-0`,points:this._getGridPoint(e,this.getTickCoord(a.value)),datum:{}});for(let i=0;i<l;i++){const r=(i+1)/(l+1),o=(1-r)*a.value+r*n.value,h=this.getTickCoord(o);t.push({id:`sub-${s}-${i+1}`,points:this._getGridPoint(e,h),datum:{}})}s===i.length-2&&t.push({id:`sub-${s}-${l+1}`,points:this._getGridPoint(e,this.getTickCoord(n.value)),datum:{}})}r=t}}return{...n,items:r}}getTextBaseline(t,e){let s="middle";const{verticalFactor:a=1}=this.attribute,n=(e?1:-1)*a;return i.isNumberClose(t[1],0)?s=!i.isNumberClose(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?s="top":t[1]<0&&(s="bottom"),s}beforeLabelsOverlap(t,e,i,s,a){const n=this.attribute.orient;"left"===n||"right"===n?Rt(n,t):"bottom"!==n&&"top"!==n||Dt(n,t)}handleLabelsOverlap(t,e,s,a,n){if(i.isEmpty(t))return;const{verticalLimitSize:r,label:l,orient:o}=this.attribute,h=this._getAxisLabelLimitLength(r,n),{layoutFunc:d,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:b,autoHide:g,autoHideMethod:_,autoHideSeparation:y}=l;i.isFunction(d)?d(t,e,a,this):(c&&function(t,e){if(i.isEmpty(t))return;const{orient:s,labelRotateAngle:a=[0,45,90]}=e;if(0===a.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(a&&a.length>0&&(r=a.length);n<r;){const e=a[n++];if(t.forEach((t=>{t.attribute.angle=i.degreeToRadian(e)})),Vt(s,t),!zt(t))break}}(t,{labelRotateAngle:u,orient:o}),p&&i.isValidNumber(h)&&h>0&&function(t,e){const{limitLength:s,ellipsis:a="...",orient:n}=e;!i.isEmpty(t)&&i.isValidNumber(s)&&t.forEach((t=>{if(("top"===n||"bottom"===n)&&Math.floor(t.AABBBounds.height())<=s)return;if(("left"===n||"right"===n)&&Math.floor(t.AABBBounds.width())<=s)return;let e=0===t.attribute.angle||i.isNil(t.attribute.angle)?"top"===n||"bottom"===n?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||a})}))}(t,{limitLength:h,ellipsis:b,orient:o}),g&&function(t,e){if(i.isEmpty(t))return;const s=t.filter(Ht);if(i.isEmpty(s))return;let a;a=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(s);const{method:n="parity",separation:r=0}=e,l=i.isFunction(n)?n:Ct[n]||Ct.parity;if(a.length>=3&&It(a,r)){do{a=l(a,r)}while(a.length>=3&&It(a,r));a.length<3&&!i.last(s).attribute.opacity&&(a.length>1&&i.last(a).setAttribute("opacity",0),i.last(s).setAttribute("opacity",1))}s.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:_,separation:y}))}afterLabelsOverlap(s,a,n,r,l){const{verticalLimitSize:o,orient:h}=this.attribute,d="bottom"===h||"top"===h,c=n.AABBBounds;let u=d?c.height():c.width();const{verticalMinSize:p}=this.attribute;if(i.isValidNumber(p)&&(!i.isValidNumber(o)||p<=o)){const i=this._getAxisLabelLimitLength(p,l);let s,a;u=Math.max(u,i),"left"===h?(s=c.x2-u,a=c.y1):"right"===h?(s=c.x1,a=c.y1):"top"===h?(s=c.x1,a=c.y2-u):"bottom"===h&&(s=c.x1,a=c.y1);const r=e.createRect({x:s,y:a,width:d?c.width():u,height:d?u:c.height(),pickable:!1});r.name=t.AXIS_ELEMENT_NAME.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),n.insertBefore(r,n.firstChild)}if(i.isValid(this.attribute.label.containerAlign)){let t;"left"===h?t=c.x2:"right"===h?t=c.x1:"top"===h?t=c.y2:"bottom"===h&&(t=c.y1),function(t,e,i,s,a){if("right"===s||"left"===s){if("left"===a){const a="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*a,textAlign:"left"})}))}else if("right"===a){const a="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*a,textAlign:"right"})}))}else if("center"===a){const a="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*a,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===a){const a="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*a,textBaseline:"top"})}))}else if("bottom"===a){const a="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*a,textBaseline:"bottom"})}))}else if("middle"===a){const a="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*a,textBaseline:"middle"})}))}}(s,t,u,h,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){const{label:s,title:a,line:n,tick:r}=this.attribute,l=s.space??4;let o=t,h=0,d=0;const c=n?.visible?n.style.lineWidth??1:0,u=r?.visible?r.length??4:0;if(a?.visible){h=S(a.text,a.textStyle).height;const t=i.normalizePadding(a.padding);d=a.space+t[0]+t[2]}return o&&(o=(o-l-d-h-c-u)/e),o}}class Ot extends Tt{static defaultAttributes=wt;constructor(t){super(i.merge({},Ot.defaultAttributes,t))}renderLine(s){const{startAngle:a=y,endAngle:n=m,radius:r,center:l,innerRadius:o=0,line:h,inside:d=!1}=this.attribute;let c=r,u=o;d&&o>0&&(c=o,u=0);const p={...l,startAngle:a,endAngle:n,radius:c,innerRadius:u,...h?.style},b=e.createCircle(p);b.name=t.AXIS_ELEMENT_NAME.line,b.id=this._getNodeId("line"),i.isEmpty(h?.state)||(b.states=i.merge({},Mt,h.state)),s.add(b)}isInValidValue(t){const{startAngle:e=y,endAngle:i=m}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=y,endAngle:s=m,center:a,radius:n,inside:r=!1,innerRadius:l=0}=this.attribute,o=e+(s-e)*t;return i.polarToCartesian(a,r&&l>0?l:n,o)}getVerticalVector(t,e=!1,i){const{inside:s=!1}=this.attribute,{center:a}=this.attribute,n=[i.x-a.x,i.y-a.y];return g(n,(e?-1:1)*(s?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(n))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){const{center:t,radius:e,innerRadius:s=0}=this.attribute,{space:a=4,textStyle:n={},shape:r,background:l,state:o,...h}=this.attribute.title;let d=t,c=0;this.attribute.label?.visible&&!1===this.attribute.label?.inside&&(c=i.get(this.attribute.label,"style.fontSize",12)+i.get(this.attribute.label,"space",4));let u=0;this.attribute.tick?.visible&&!1===this.attribute.tick?.inside&&(u=this.attribute.tick?.length||4),this.attribute.subTick?.visible&&!1===this.attribute.subTick?.inside&&(u=Math.max(u,this.attribute.subTick?.length||2));const p=e+u+c+a;let b="middle",{position:g}=this.attribute.title;i.isNil(g)&&(g=0===s?"end":"middle"),"start"===g?(b="bottom",d={x:t.x,y:t.y-p}):"end"===g&&(b="top",d={x:t.x,y:t.y+p});const _={...d,...h,textStyle:{textBaseline:b,textAlign:"center",...n},state:{text:i.merge({},Mt,o?.text),shape:i.merge({},Mt,o?.shape),panel:i.merge({},Mt,o?.background)}},{angle:y}=h;return _.angle=y,r&&r.visible&&(_.shape={visible:!0,...r.style},r.space&&(_.space=r.space)),l&&l.visible&&(_.panel={visible:!0,...l.style}),_}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:a=2}=t,n=this.tickLineItems,r=n.length;if(r>=2){const t=this.data[1].value-this.data[0].value,l=this.attribute?.tick?.alignWithLabel;for(let o=0;o<r;o++){const r=n[o],h=n[o+1];for(let n=0;n<i;n++){const o=(n+1)/(i+1),d=(1-o)*r.value+o*(h?h.value:l?1:r.value+t),c=this.getTickCoord(d),u=this.getVerticalCoord(c,a,s);e.push({start:c,end:u,value:d})}}}return e}getGridAttribute(t){let e,s=[];const{radius:a,innerRadius:n=0,startAngle:r=y,endAngle:l=m,center:o,grid:h}=this.attribute,{alignWithLabel:d=!0}=h||{},c=a-n;let u=1;if(this.data.length>=2&&(u=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let i;i=Math.abs(l-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,i.forEach((e=>{let{point:i}=e;if(!d){const t=e.value-u/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,s],datum:e})})),s=t}else{e=i.merge({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{},n=this.data.length;if(n>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!d){const e=t.value-u/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i<n;i++){const s=e[i],n=e[i+1];t.push({id:`sub-${i}-0`,points:[this.getTickCoord(s.value),this.getVerticalCoord(this.getTickCoord(s.value),c,!0)],datum:{}});for(let e=0;e<a;e++){const r=(e+1)/(a+1),l=(1-r)*s.value+r*(n?n.value:d?1:s.value+u),o=this.getTickCoord(l),h=this.getVerticalCoord(o,c,!0);t.push({id:`sub-${i}-${e+1}`,points:[o,h],datum:{}})}}Math.abs(l-r)%(2*Math.PI)==0&&t.push(t[0]),s=t}}return{...e,items:s,center:o}}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,a){}handleLabelsOverlap(t,e,i,s,a){}afterLabelsOverlap(t,e,i,s,a){}}class $t extends e.ACustomAnimate{_oldElementMap;_newElementAttrMap;mode=e.AnimateMode.NORMAL;onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return l(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},l(t,(t=>{if("group"!==t.type&&t.id){const e=this._oldElementMap[t.id];if(e){if(!i.isEqual(t.attribute,e.attribute)){const s=i.cloneDeep(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:{...s,opacity:s.opacity??1,fillOpacity:s.fillOpacity??1,strokeOpacity:s.strokeOpacity??1}},t.setAttributes(e.attribute)}}else{const e={opacity:t.attribute.opacity??1,fillOpacity:t.attribute.fillOpacity??1,strokeOpacity:t.attribute.strokeOpacity??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=>{const{node:a,attrs:n,state:r}=this._newElementAttrMap[s];"enter"===r&&(t=i.isValidNumber(this.params.enter?.duration)?this.params.enter.duration:t,e=this.params.enter?.easing?this.params.enter?.easing:e),"path"===a.type?a.animate({interpolate:(t,e,s,a,n)=>"path"===t&&(n.path=i.interpolateString(s,a)(e),!0)}).to(n,t,e):a.animate().to(n,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 Wt 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}})}}var Ft;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(Ft||(Ft={}));const Gt={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"}}};class Yt extends n{name="dataZoom";static defaultAttributes=Gt;_isHorizontal;_background;_container;_startHandler;_middleHandlerSymbol;_middleHandlerRect;_endHandler;_selectedBackground;_dragMask;_startText;_endText;_startValue;_endValue;_showText;_previewData=[];_previewGroup;_previewLine;_previewArea;_selectedPreviewGroupClip;_selectedPreviewGroup;_selectedPreviewLine;_selectedPreviewArea;_activeTag;_activeItem;_activeState=!1;_activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}};_layoutCache={attPos:"x",attSize:"width",max:0};state={start:0,end:1};_previewCallbackX;_previewCallbackY;_previewCallbackX1;_previewCallbackY1;_updateStateCallback;_statePointToData=t=>t;_layoutAttrFromConfig;constructor(t){super(i.merge({},Yt.defaultAttributes,t));const{start:e,end:s,size:a,orient:n,showDetail:r,position:l,previewData:o,previewCallbackX:h,previewCallbackY:d,previewCallbackX1:c,previewCallbackY1:u,updateStateCallback:p}=this.attribute,{width:b,height:g}=a;e&&(this.state.start=e),s&&(this.state.end=s),this._isHorizontal="top"===n||"bottom"===n,this._layoutCache.max=this._isHorizontal?b:g,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(h)&&(this._previewCallbackX=h),i.isFunction(d)&&(this._previewCallbackY=d),i.isFunction(c)&&(this._previewCallbackX1=c),i.isFunction(u)&&(this._previewCallbackY1=u),i.isFunction(p)&&(this._updateStateCallback=p)}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.global.env&&(e.global.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),e.global.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){const e=this.stage?.window.getBoundingClientRect();return{x:t.clientX-(e?.left||0)-(this.stage?.x||0),y:t.clientY-(e?.top||0)-(this.stage?.y||0)}}_onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=Ft.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=Ft.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=Ft.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=Ft.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=Ft.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)};_onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:s}=this.attribute,a=this.eventPosToStagePos(t),{attPos:n,max:r}=this._layoutCache,l=(a[n]-this._activeCache.lastPos[n])/r;this._activeState&&(this._activeTag===Ft.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===Ft.startHandler?this.state.start+l>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+l,this._activeTag=Ft.endHandler):this.state.start=this.state.start+l:this._activeTag===Ft.endHandler&&(this.state.end+l<this.state.start?(this.state.end=this.state.start,this.state.start=this.state.end+l,this._activeTag=Ft.startHandler):this.state.end=this.state.end+l),this._activeCache.lastPos=a,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))};_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:s}=this.attribute;if(this._activeState&&this._activeTag===Ft.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:a}=this.attribute,n=t[i]-a[i],r=e[i]-a[i],l=Math.min(Math.max(Math.min(n,r)/s,0),1),o=Math.min(Math.max(Math.max(n,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:a}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",{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===Ft.background&&Math.abs(this.dragMaskSize())||0,height:a,...t},"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",{x:e.x,y:i.clamp(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+a),width:s,height:this._activeState&&this._activeTag===Ft.background&&Math.abs(this.dragMaskSize())||0,...t},"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:s,...a}=t,{formatMethod:n,...r}=e,{start:l,end:o}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(o);const{position:h,width:d,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,i.merge({},a,{text:s?s(this._startValue):this._startValue,x:h.x+l*d,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:n?n(this._endValue):this._endValue,x:h.x+o*d,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({},a,{text:s?s(this._startValue):this._startValue,x:h.x+d/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:n?n(this._endValue):this._endValue,x:h.x+d/2,y:h.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${h}`))}getLayoutAttrFromConfig(){if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:t,size:e,orient:i,middleHandlerStyle:s,startHandlerStyle:a,endHandlerStyle:n}=this.attribute,{width:r,height:l}=e,o=s?.background?.size??10;let h,d,c;s?.visible?this._isHorizontal?(h=r,d=l-o,c={x:t.x,y:t.y+o}):(h=r-o,d=l,c={x:t.x+("left"===i?o:0),y:t.y}):(h=r,d=l,c=t);const u=a?.size??(this._isHorizontal?d:h),p=n?.size??(this._isHorizontal?d:h);return a?.visible&&(this._isHorizontal?(h-=(u+p)/2,c={x:c.x+u/2,y:c.y}):(d-=(u+p)/2,c={x:c.x,y:c.y+u})),this._layoutAttrFromConfig={position:c,width:h,height:d},this._layoutAttrFromConfig}render(){this._layoutAttrFromConfig=null;const{orient:t,backgroundStyle:e,backgroundChartStyle:i,selectedBackgroundStyle:s,selectedBackgroundChartStyle:a,middleHandlerStyle:n,startHandlerStyle:r,endHandlerStyle:l,brushSelect:o}=this.attribute,{start:h,end:d}=this.state,{position:c,width:u,height:p}=this.getLayoutAttrFromConfig(),b=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=b,this._background=b.createOrUpdateChild("background",{x:c.x,y:c.y,width:u,height:p,cursor:o?"crosshair":"auto",...e},"rect"),i?.line?.visible&&this.setPreviewAttributes("line",b),i?.area?.visible&&this.setPreviewAttributes("area",b),o&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=b.createOrUpdateChild("selectedBackground",{x:c.x+h*u,y:c.y,width:(d-h)*u,height:p,cursor:o?"crosshair":"move",...s},"rect"):this._selectedBackground=b.createOrUpdateChild("selectedBackground",{x:c.x,y:c.y+h*p,width:u,height:(d-h)*p,cursor:o?"crosshair":"move",...s},"rect"),a?.line?.visible&&this.setSelectedPreviewAttributes("line",b),a?.area?.visible&&this.setSelectedPreviewAttributes("area",b),this.renderText(),this._isHorizontal?(this._startHandler=b.createOrUpdateChild("startHandler",{x:c.x+h*u,y:c.y+p/2,size:p,angle:0,symbolType:r?.symbolType??"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",...r},"symbol"),this._endHandler=b.createOrUpdateChild("endHandler",{x:c.x+d*u,y:c.y+p/2,size:p,angle:0,symbolType:l?.symbolType??"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",...l},"symbol"),n?.visible&&(this._middleHandlerRect=b.createOrUpdateChild("middleHandlerRect",{x:c.x+h*u,y:c.y-(n?.background?.size||10),width:(d-h)*u,height:n?.background?.size||10,...n?.background?.style},"rect"),this._middleHandlerSymbol=b.createOrUpdateChild("middleHandlerSymbol",{x:c.x+(h+d)/2*u,y:c.y-(n?.background?.size||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:n?.icon?.symbolType??"square",...n?.icon},"symbol"))):(this._startHandler=b.createOrUpdateChild("startHandler",{x:c.x+u/2,y:c.y+h*p,size:u,angle:Math.PI/180*90,symbolType:r?.symbolType??"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0,...r},"symbol"),n?.visible&&(this._middleHandlerRect=b.createOrUpdateChild("middleHandlerRect",{x:"left"===t?c.x-(n?.background?.size||10):c.x+u,y:c.y+h*p,width:n?.background?.size||10,height:(d-h)*p,...n?.background?.style},"rect"),this._middleHandlerSymbol=b.createOrUpdateChild("middleHandlerSymbol",{x:"left"===t?c.x-(n?.background?.size||10)/2:c.x+u+(n?.background?.size||10)/2,y:c.y+(h+d)/2*p,angle:Math.PI/180*90,symbolType:n?.icon?.symbolType??"square",strokeBoundsBuffer:0,...n?.icon},"symbol")),this._endHandler=b.createOrUpdateChild("endHandler",{x:c.x+u/2,y:c.y+d*p,size:u,angle:Math.PI/180*90,symbolType:l?.symbolType??"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0,...l},"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let a,n;return this._isHorizontal?(a=[{x:e.x,y:e.y+s}],n=[{x:e.x+i,y:e.y+s}]):"left"===t?(a=[{x:e.x+i,y:e.y}],n=[{x:e.x+i,y:e.y+s}]):(a=[{x:e.x,y:e.y+s}],n=[{x:e.x,y:e.y}]),{basePointStart:a,basePointEnd:n}}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({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1,...i?.line}),"area"===t&&this._previewArea.setAttributes({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1,...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:a}=this.state,{position:n,width:r,height:l}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+s*r:n.x,y:this._isHorizontal?n.y:n.y+s*l,width:this._isHorizontal?(a-s)*r:r,height:this._isHorizontal?l:(a-s)*l,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+s*r:n.x),y:-(this._isHorizontal?n.y:n.y+s*l),width:this._isHorizontal?(a-s)*r:r,height:this._isHorizontal?l:(a-s)*l,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1,...i?.line}),"area"===t&&this._selectedPreviewArea.setAttributes({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1,...i?.area})}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new E(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:s,end:a}=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&&a===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(){const{middleHandlerStyle:t}=this.attribute,e=t?.background?.size??10,s=t?.icon?.size??10;return Math.max(e,...i.array(s))}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 Xt,qt,Zt;t.IMarkLineLabelPosition=void 0,(Xt=t.IMarkLineLabelPosition||(t.IMarkLineLabelPosition={})).start="start",Xt.middle="middle",Xt.end="end",Xt.insideStartTop="insideStartTop",Xt.insideStartBottom="insideStartBottom",Xt.insideMiddleTop="insideMiddleTop",Xt.insideMiddleBottom="insideMiddleBottom",Xt.insideEndTop="insideEndTop",Xt.insideEndBottom="insideEndBottom",t.IMarkAreaLabelPosition=void 0,(qt=t.IMarkAreaLabelPosition||(t.IMarkAreaLabelPosition={})).left="left",qt.right="right",qt.top="top",qt.bottom="bottom",qt.middle="middle",qt.insideLeft="insideLeft",qt.insideRight="insideRight",qt.insideTop="insideTop",qt.insideBottom="insideBottom",t.IMarkPointItemPosition=void 0,(Zt=t.IMarkPointItemPosition||(t.IMarkPointItemPosition={})).top="top",Zt.bottom="bottom",Zt.middle="middle",Zt.insideTop="insideTop",Zt.insideBottom="insideBottom",Zt.insideMiddle="insideMiddle";class jt extends n{_container;_label;render(){const t=this.attribute.visible??!0;if((this.attribute.interactive??!1)||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),t)if(this._container)this._container.setAttributes({...this.attribute?.clipRange,clip:i.isValid(this.attribute?.clipRange)??!1}),this.updateMarker();else{const t=e.createGroup({...this.attribute?.clipRange,clip:i.isValid(this.attribute?.clipRange)??!1});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const Jt={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]}},Kt={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"}},Qt={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}},te={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"}},ee={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}}},ie={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"}};class se extends jt{static defaultAttributes=Jt;_line;constructor(t){super(i.merge({},se.defaultAttributes,t))}setLabelPos(){const{points:t,label:e}=this.attribute,i=e?.position??"end",s=this._line.getEndAngle(),a=e?.refX*Math.cos(s)+e.refY*Math.cos(s-Math.PI/2),n=e?.refX*Math.sin(s)+e.refY*Math.sin(s-Math.PI/2);i.includes("start")||i.includes("Start")?this._label?.setAttributes({x:t[0].x+a,y:t[0].y+n}):i.includes("middle")||i.includes("Middle")?this._label?.setAttributes({x:(t[0].x+t[t.length-1].x)/2+a,y:(t[0].y+t[t.length-1].y)/2+n}):this._label?.setAttributes({x:t[t.length-1].x+a,y:t[t.length-1].y+n}),this._label.setAttributes({angle:e.autoRotate&&s+(e?.refAngle??0),textStyle:{...Kt[i],...e.textStyle}})}initMarker(t){const{points:e,startSymbol:i,endSymbol:s,label:a,lineStyle:n}=this.attribute,r=new kt({points:e,startSymbol:i,endSymbol:s,lineStyle:n});r.name="mark-line-line",this._line=r,t.add(r);const l=new E({...a});l.name="mark-line-label",this._label=l,t.add(l),this.setLabelPos()}updateMarker(){const{points:t,startSymbol:e,endSymbol:i,label:s,lineStyle:a}=this.attribute;this._line?.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:a}),this._label?.setAttributes({...s}),this.setLabelPos()}}class ae extends jt{static defaultAttributes=Qt;_area;constructor(t){super(i.merge({},ae.defaultAttributes,t))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){const{label:t}=this.attribute,e=t?.position??"middle";e.includes("left")||e.includes("Left")?this._label?.setAttributes({...this.getLeftPos()}):e.includes("right")||e.includes("Right")?this._label?.setAttributes({...this.getRightPos()}):e.includes("top")||e.includes("Top")?this._label?.setAttributes({...this.getTopPos()}):e.includes("bottom")||e.includes("Bottom")?this._label?.setAttributes({...this.getBottomPos()}):this._label?.setAttributes({...this.getMiddlePos()}),this._label?.setAttributes({textStyle:{...te[e],...t.textStyle}})}initMarker(t){const{points:i,label:s,areaStyle:a}=this.attribute,n=e.createPolygon({points:i,...a});n.name="mark-area-area",this._area=n,t.add(n);const r=new E({...s});r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i}=this.attribute;this._area?.setAttributes({points:t,...i}),this._label?.setAttributes({...e}),this.setLabelPos()}}class ne extends jt{static defaultAttributes=ee;_item;_line;_decorativeLine;constructor(t){super(i.merge({},ne.defaultAttributes,t))}setLabelPos(){}setItemAttributes(e,i,s,a){const{autoRotate:n=!0,refX:r=0,refY:l=0,refAngle:o=0,textStyle:h,richTextStyle:d,imageStyle:c,position:u=t.IMarkPointItemPosition.middle}=i,p=this._line?.getEndAngle()||0,b=r*Math.cos(p)+l*Math.cos(p-Math.PI/2),g=r*Math.sin(p)+l*Math.sin(p-Math.PI/2);"text"===a?e?.setAttributes({...h,textStyle:{...ie[i?.position||"end"],...h?.textStyle}}):"richText"===a?e?.setAttributes({dx:this.getItemDx(e,u,d)+(d?.dx||0),dy:this.getItemDy(e,u,d)+(d?.dy||0)}):"image"===a&&e?.setAttributes({dx:this.getItemDx(e,u,c)+(c?.dx||0),dy:this.getItemDy(e,u,c)+(c?.dy||0)}),e?.setAttributes({x:s.x+(b||0),y:s.y+(g||0),angle:n&&p+o})}getItemDx(t,e,i){const s=t?.AABBBounds?.width()??(i?.width||0);return e.includes("inside")?-s:0}getItemDy(t,e,i){const s=t?.AABBBounds?.height()??(i?.height||0);return e.includes("top")||e.includes("Top")?-s:e.includes("middle")||e.includes("Middle")?-s/2:0}initItem(t,i){const{type:s="text",symbolStyle:a,richTextStyle:n,imageStyle:r,renderCustomCallback:l}=t;let o;return"symbol"===s?o=e.createSymbol({...i,...a}):"text"===s?o=new E({...i}):"richText"===s?o=e.createRichText({...i,...n}):"image"===s?o=e.createImage({...i,...r}):"custom"===s&&l&&(o=l()),this.setItemAttributes(o,t,i,s),o}getItemLineAttr(t,e,i){let s=[];const{type:a="type-s"}=t;return s="type-do"===a?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===a?[e,{x:i.x,y:e.y},i]:"type-op"===a?[e,{x:e.x,y:i.y},i]:[e,i],s}setItemLineAttr(t,e,i,s){const{startSymbol:a,endSymbol:n,lineStyle:r}=t,l=this.getItemLineAttr(t,e,i);this._line?.setAttributes({points:l,startSymbol:a,endSymbol:n,lineStyle:r,visible:s})}getDecorativeLineAttr(t,e){const i=t?.decorativeLine?.length||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:i/2*Math.cos(s-Math.PI/2),startPointOffsetY:i/2*Math.sin(s-Math.PI/2),endPointOffsetX:-i/2*Math.cos(s-Math.PI/2),endPointOffsetY:-i/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){const{lineStyle:s}=t,{startPointOffsetX:a,startPointOffsetY:n,endPointOffsetX:r,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);this._decorativeLine?.setAttributes({points:[{x:e.x+a,y:e.y+n},{x:e.x+r,y:e.y+l}],...s,visible:i})}initMarker(t){const{position:i,itemLine:s,itemContent:a}=this.attribute,n={x:i.x+(a?.offsetX||0),y:i.y+(a?.offsetY||0)},r=new kt({points:[]});r.name="mark-point-line",this._line=r,t.add(r);const l=e.createLine({points:[]});l.name="mark-point-decorativeLine",this._decorativeLine=l,t.add(l),this.setItemLineAttr(s,i,n,s?.visible),this.setDecorativeLineAttr(s,n,s?.decorativeLine?.visible);const o=this.initItem(a,n);this._item=o,t.add(o)}updateMarker(){const{position:t,itemLine:e,itemContent:i}=this.attribute,{type:s="text"}=i,a={x:t.x+(i?.offsetX||0),y:t.y+(i?.offsetY||0)};this.setItemLineAttr(e,t,a,e?.visible),this.setDecorativeLineAttr(e,a,e?.decorativeLine?.visible),this.setItemAttributes(this._item,i,a,s)}}const re={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class le extends n{name="pager";_current=1;getCurrent(){return this._current}_total;preHandler;nextHandler;text;static defaultAttributes={handler:re,textStyle:{fill:"rgb(51, 51, 51)",fontSize:12}};constructor(t){super(i.merge({},le.defaultAttributes,t))}render(){this._reset();const{layout:t="horizontal",handler:s=re,total:a,defaultCurrent:n=1,textStyle:r,padding:l=0}=this.attribute;this._current=n;const o=i.normalizePadding(l),h="horizontal"===t,d=e.createGroup({x:0,y:0}),c=s.style||{},u=c.size||15,p=s.space??8,b=s.state||{};let{preShape:g,nextShape:_}=s;g||(g=h?"triangleLeft":"triangleUp"),_||(_=h?"triangleRight":"triangleDown");const y=e.createSymbol({strokeBoundsBuffer:0,pickMode:"imprecise",...c,x:0,y:0,symbolType:g,size:u});y.states=b,y.name="preHandler",this.preHandler=y,d.add(y);const{width:m,height:x}=S(`${a}/${a}`,{textAlign:"center",textBaseline:"middle",...r}),f=i.isNumber(u)?u:u[0],v=i.isNumber(u)?u:u[1],A=e.createText({x:h?f/2+p+m/2:0,y:h?0:v/2+p+x/2,text:`${n}/${a}`,textAlign:"center",textBaseline:"middle",lineHeight:r?.fontSize,...r});this.text=A,d.add(A);const E=e.createSymbol({strokeBoundsBuffer:0,pickMode:"imprecise",...c,x:h?f+2*p+m:0,y:h?0:v+2*p+x,symbolType:_,size:u});E.name="nextHandler",E.states=b,this.nextHandler=E,d.add(E),1===this._total?(y.addState("disable"),E.addState("disable")):1===this._current?y.addState("disable"):this._current===a&&E.addState("disable");const k=d.AABBBounds,L=k.width(),B=k.height();d.translateTo(0-k.x1+o[3],0-k.y1+o[0]),this.add(d),this.attribute.width=L+o[1]+o[3],this.attribute.height=B+o[0]+o[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))}_onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")};_onUnHover=t=>{t.target.removeState("hover")};_onClick=t=>{const i=t.target;if("preHandler"===i.name){if(1===this._current)return;this._current-=1,1===this._current?i.addState("disable"):i.removeState("disable");const t=new e.CustomEvent("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=this.stage?.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===i.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?i.addState("disable"):i.removeState("disable");const t=new e.CustomEvent("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=this.stage?.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current<this._total&&this.nextHandler.removeState("disable"),this.text.setAttribute("text",`${this._current}/${this._total}`)};_reset(){this.removeAllChild(),this._current=1,this._total=this.attribute.total,this.preHandler=this.nextHandler=this.text=null}}const oe=16,he=8,de=12,ce=12;var ue,pe,be;t.LegendStateValue=void 0,(ue=t.LegendStateValue||(t.LegendStateValue={})).selected="selected",ue.unSelected="unSelected",ue.selectedHover="selectedHover",ue.unSelectedHover="unSelectedHover",ue.focus="focus",t.LegendEvent=void 0,(pe=t.LegendEvent||(t.LegendEvent={})).legendItemHover="legendItemHover",pe.legendItemUnHover="legendItemUnHover",pe.legendItemClick="legendItemClick",t.LEGEND_ELEMENT_NAME=void 0,(be=t.LEGEND_ELEMENT_NAME||(t.LEGEND_ELEMENT_NAME={})).innerView="innerView",be.title="legendTitle",be.item="legendItem",be.itemShape="legendItemShape",be.itemLabel="legendItemLabel",be.itemValue="legendItemValue",be.focus="legendItemFocus";class ge extends n{name="legend";_innerView;_title=null;render(){this.removeAllChild();const{interactive:s=!0,title:a,padding:n=0}=this.attribute,r=i.normalizePadding(n),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,a?.visible&&this._renderTitle(a),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:a,padding:n=0,background:r,minWidth:l,maxWidth:o,shape:h}=e,d={x:0,y:0,text:s,textStyle:a,padding:i.normalizePadding(n),minWidth:l,maxWidth:o};h&&h.visible&&(d.shape={visible:!0,...h.style},i.isValid(h.space)&&(d.space=h.space)),r&&r.visible&&(d.panel={visible:!0,...r.style});const c=new E(d);c.name=t.LEGEND_ELEMENT_NAME.title,this._title=c,this._innerView.add(c)}_adjustLayout(){if(this._title){const t=this._innerView.AABBBounds.width(),e=this._title.AABBBounds.width(),i=this.attribute.title?.align;"center"===i?this._title.setAttribute("x",(t-e)/2):"end"===i&&this._title.setAttribute("x",t-e)}}}const _e={[t.LegendStateValue.focus]:{},[t.LegendStateValue.selected]:{},[t.LegendStateValue.selectedHover]:{},[t.LegendStateValue.unSelected]:{},[t.LegendStateValue.unSelectedHover]:{}};class ye extends ge{name="discreteLegend";_itemsContainer=null;_itemWidthByUser;_itemHeightByUser=void 0;_itemHeight=0;_itemMaxWidth=0;_pager;static defaultAttributes={layout:"horizontal",title:{align:"start",space:de,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:oe,spaceRow:he,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:ce,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};constructor(t){super(i.merge({},ye.defaultAttributes,t))}setSelected(e){(this._itemsContainer?.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:a,maxCol:n=1,maxRow:r=2}=this.attribute;if(!1===t.visible||i.isEmpty(s))return;let l=s;a&&(l=s?.reverse());const o=e.createGroup({x:0,y:0});this._itemsContainer=o;const{layout:h,maxWidth:d,maxHeight:c,defaultSelected:u=[],autoPage:p}=this.attribute,b="horizontal"===h,{spaceCol:g=oe,spaceRow:_=he,maxWidth:y,width:m,height:x}=t;i.isValid(y)?i.isValid(m)?this._itemWidthByUser=Math.min(y,m):this._itemWidthByUser=y:i.isValid(m)&&(this._itemWidthByUser=m),i.isValid(x)&&(this._itemHeightByUser=x);let f=!1,v=0,A=0,S=0,E=1,k=1;l.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const s=this._renderEachItem(t,!!i.isEmpty(u)||u?.includes(t.label),e,l),a=s.attribute.width,h=s.attribute.height;this._itemHeight=Math.max(this._itemHeight,h),v=Math.max(a,v),this._itemMaxWidth=Math.max(a,this._itemMaxWidth),b?(E=r,i.isValid(d)&&(a>=d?(f=!0,e>0&&(A=0,S+=h+_,k+=1)):d<A+a&&(f=!0,A=0,S+=h+_,k+=1)),e>0&&s.setAttributes({x:A,y:S}),A+=g+a):(E=n,i.isValid(c)&&c<S+h&&(f=!0,S=0,A+=v+g,v=0,k+=1),e>0&&s.setAttributes({x:A,y:S}),S+=_+h),o.add(s)}));let L=!1;f&&p&&k>E&&(L=this._renderPager(b)),L||(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,a,n,r){const{id:l,label:o,value:h,shape:d}=s,{padding:c=0,focus:u,focusIconStyle:p={}}=this.attribute.item;let{shape:b={},label:g={},value:_={},background:y={}}=this.attribute.item;b=this._handleStyle(b,s,a,n,r),g=this._handleStyle(g,s,a,n,r),_=this._handleStyle(_,s,a,n,r),y=this._handleStyle(y,s,a,n,r);const m=i.normalizePadding(c);let x;!1===y.visible?(x=e.createGroup({x:0,y:0,cursor:(y?.style).cursor}),this._appendDataToShape(x,t.LEGEND_ELEMENT_NAME.item,s,x)):(x=e.createGroup({x:0,y:0,...y?.style}),this._appendDataToShape(x,t.LEGEND_ELEMENT_NAME.item,s,x,y?.state)),x.addState(a?t.LegendStateValue.selected:t.LegendStateValue.unSelected);const f=e.createGroup({x:0,y:0,pickable:!1});x.add(f);let v=0;const A=i.get(b,"style.size",10),S=i.get(b,"space",8),E=e.createSymbol({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0,...d,...b.style});let k;Object.keys(b.state||{}).forEach((t=>{const e=b.state[t].fill||b.state[t].stroke;d.fill&&i.isNil(b.state[t].fill)&&e&&(b.state[t].fill=e),d.stroke&&i.isNil(b.state[t].stroke)&&e&&(b.state[t].stroke=e)})),this._appendDataToShape(E,t.LEGEND_ELEMENT_NAME.itemShape,s,x,b?.state),E.addState(a?t.LegendStateValue.selected:t.LegendStateValue.unSelected),f.add(E);let L=0;if(u){const a=i.get(p,"size",10);k=e.createSymbol({x:0,y:-a/2-1,strokeBoundsBuffer:0,...p,visible:!1,pickMode:"imprecise",boundsPadding:m}),this._appendDataToShape(k,t.LEGEND_ELEMENT_NAME.focus,s,x),L=a}const B=e.createText({x:A/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(g?.style).fontSize,...g?.style,text:g.formatMethod?g.formatMethod(o,s,n):o});this._appendDataToShape(B,t.LEGEND_ELEMENT_NAME.itemLabel,s,x,g?.state),B.addState(a?t.LegendStateValue.selected:t.LegendStateValue.unSelected),f.add(B);const M=i.get(g,"space",8);if(v+=A/2+S+B.AABBBounds.width()+M,i.isValid(h)){const r=i.get(_,"space",u?8:0),l=e.createText({x:v+M,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(_?.style).fontSize,..._?.style,text:_.formatMethod?_.formatMethod(h,s,n):h});this._appendDataToShape(l,t.LEGEND_ELEMENT_NAME.itemValue,s,x,_?.state),l.addState(a?t.LegendStateValue.selected:t.LegendStateValue.unSelected),this._itemWidthByUser&&(l.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-A-S-B.AABBBounds.width()-M-L-r),_.alignRight&&l.setAttributes({textAlign:"right",x:this._itemWidthByUser-A/2-m[1]-m[3]-L-r})),v=l.AABBBounds.x2+r,f.add(l)}else this._itemWidthByUser&&B.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-A-S-L);k&&(k.setAttribute("x",v),f.add(k));const w=f.AABBBounds,T=w.width(),C=w.height(),P=i.isValid(this.attribute.item.width)?this.attribute.item.width:T+m[1]+m[3],I=this._itemHeightByUser||C+m[0]+m[2];return x.attribute.width=P,x.attribute.height=I,f.translateTo(-w.x1+m[3],-w.y1+m[0]),x}_renderPager(t){const s=this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",8):0,{maxWidth:a,maxHeight:n,maxCol:r=1,maxRow:l=2,item:o={},pager:h={}}=this.attribute,{spaceCol:d=oe,spaceRow:c=he}=o,u=this._itemsContainer,{animation:p=!0,animationDuration:b=450,animationEasing:g="quadIn",space:_=ce,...y}=h;let m,x=0,f=0,v=0,A=0,S=1;if(t){if(m=new le({layout:1===l?"horizontal":"vertical",total:99,...i.merge({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},y)}),this._pager=m,this._innerView.add(m),x=(l-1)*c+this._itemHeight*l,f=a-m.AABBBounds.width()-_,f<=0)return this._innerView.removeChild(m),!1;u.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;f<v+i&&(v=0,A+=s+c,S+=1),e>0&&t.setAttributes({x:v,y:A}),v+=d+i})),m.setAttributes({total:Math.ceil(S/l),x:f,y:s+x/2-m.AABBBounds.height()/2})}else{if(m=new le({layout:"horizontal",total:99,...y}),this._pager=m,this._innerView.add(m),f=this._itemMaxWidth*r+(r-1)*d,x=n-m.AABBBounds.height()-_-s,x<=0)return this._innerView.removeChild(m),!1;u.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;x<A+i&&(A=0,v+=this._itemMaxWidth+d,S+=1),e>0&&t.setAttributes({x:v,y:A}),A+=c+i})),m.setAttributes({total:Math.ceil(S/r),x:(f-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}h.defaultCurrent>1&&(t?u.setAttribute("y",-(h.defaultCurrent-1)*(x+c)):u.setAttribute("x",-(h.defaultCurrent-1)*(f+d)));const E=e.createGroup({x:0,y:s,width:f,height:x,clip:!0,pickable:!1});E.add(u),this._innerView.add(E);const k=e=>{const{current:i}=e.detail;p?u.animate().to(t?{y:-(i-1)*(x+c)}:{x:-(i-1)*(f+d)},b,g):t?u.setAttribute("y",-(i-1)*(x+c)):u.setAttribute("x",-(i-1)*(f+d))};return this._pager.addEventListener("toPrev",k),this._pager.addEventListener("toNext",k),!0}_onHover=e=>{const i=e.target;if(i?.name?.startsWith(t.LEGEND_ELEMENT_NAME.item)){const e=i.delegate;e.hasState(t.LegendStateValue.selected)?this._setLegendItemState(e,t.LegendStateValue.selectedHover):this._setLegendItemState(e,t.LegendStateValue.unSelectedHover);const s=e.getChildren()[0].find((e=>e.name===t.LEGEND_ELEMENT_NAME.focus),!1);s&&s.setAttribute("visible",!0),this._dispatchEvent(t.LegendEvent.legendItemHover,e)}};_onUnHover=e=>{const i=e.target;if(i?.name?.startsWith(t.LEGEND_ELEMENT_NAME.item)){const e=i.delegate;e.removeState(t.LegendStateValue.unSelectedHover),e.removeState(t.LegendStateValue.selectedHover),e.getChildren()[0].getChildren().forEach((e=>{e.removeState(t.LegendStateValue.unSelectedHover),e.removeState(t.LegendStateValue.selectedHover)}));const s=e.getChildren()[0].find((e=>e.name===t.LEGEND_ELEMENT_NAME.focus),!1);s&&s.setAttribute("visible",!1),this._dispatchEvent(t.LegendEvent.legendItemUnHover,e)}};_onClick=e=>{const i=e.target;if(i?.name?.startsWith(t.LEGEND_ELEMENT_NAME.item)){const e=i.delegate;if(i.name===t.LEGEND_ELEMENT_NAME.focus){const i=e.hasState(t.LegendStateValue.focus);e.toggleState(t.LegendStateValue.focus),i?this._itemsContainer?.getChildren().forEach((e=>{this._removeLegendItemState(e,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover,t.LegendStateValue.focus]),this._setLegendItemState(e,t.LegendStateValue.selected)})):(this._setLegendItemState(e,t.LegendStateValue.selected),this._removeLegendItemState(e,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover]),this._itemsContainer?.getChildren().forEach((i=>{e!==i&&(this._removeLegendItemState(i,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover,t.LegendStateValue.focus]),this._setLegendItemState(i,t.LegendStateValue.unSelected))})))}else{this._itemsContainer?.getChildren().forEach((e=>{e.removeState(t.LegendStateValue.focus)}));const{selectMode:i="multiple",allowAllCanceled:s=!0}=this.attribute,a=e.hasState(t.LegendStateValue.selected),n=this._getSelectedLegends();if("multiple"===i){if(!1===s&&a&&1===n.length)return void this._dispatchEvent(t.LegendEvent.legendItemClick,e);a?(this._removeLegendItemState(e,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover]),this._setLegendItemState(e,t.LegendStateValue.unSelected)):(this._setLegendItemState(e,t.LegendStateValue.selected),this._removeLegendItemState(e,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover]))}else this._setLegendItemState(e,t.LegendStateValue.selected),this._removeLegendItemState(e,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover]),this._itemsContainer?.getChildren().forEach((i=>{e!==i&&(this._removeLegendItemState(i,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover]),this._setLegendItemState(i,t.LegendStateValue.unSelected))}))}this._dispatchEvent(t.LegendEvent.legendItemClick,e)}};_setLegendItemState(e,i,s=!0){e.addState(i,s),e.getChildren()[0].getChildren().forEach((e=>{e.name!==t.LEGEND_ELEMENT_NAME.focus&&e.addState(i,s)}))}_removeLegendItemState(e,i){i.forEach((t=>{e.removeState(t)})),e.getChildren()[0].getChildren().forEach((e=>{e.name!==t.LEGEND_ELEMENT_NAME.focus&&i.forEach((t=>{e.removeState(t)}))}))}_getSelectedLegends(){const e=[];return this._itemsContainer?.getChildren().forEach((i=>{i.hasState(t.LegendStateValue.selected)&&e.push(i.data)})),e}_appendDataToShape(t,e,s,a,n={}){t.name=e,t.data=s,t.delegate=a,t.states=i.merge({},_e,n)}_dispatchEvent(i,s){const a=this._getSelectedLegends();a.sort(((t,e)=>t.index-e.index));const n=a.map((t=>t.label)),r=new e.CustomEvent(i,{item:s,data:s.data,selected:s.hasState(t.LegendStateValue.selected),currentSelectedItems:a,currentSelected:n});r.manager=this.stage?.eventSystem.manager,this.dispatchEvent(r)}_handleStyle(t,e,s,a,n){const r=i.merge({},t);return t.style&&i.isFunction(t.style)&&(r.style=t.style(e,s,a,n)),t.state&&Object.keys(t.state).forEach((l=>{t.state[l]&&i.isFunction(t.state[l])&&(r.state[l]=t.state[l](e,s,a,n))})),r}}var me;function xe(t){return i.isArray(t)?t:[t,t]}function fe(t){return t?"ew-resize":"ns-resize"}t.SLIDER_ELEMENT_NAME=void 0,(me=t.SLIDER_ELEMENT_NAME||(t.SLIDER_ELEMENT_NAME={})).innerView="innerView",me.railContainer="sliderRailContainer",me.rail="sliderRail",me.startText="sliderStartText",me.endText="sliderEndText",me.startHandler="sliderStartHandler",me.startHandlerText="startHandlerText",me.endHandler="sliderEndHandler",me.endHandlerText="sliderEndHandlerText",me.track="sliderTrack",me.trackContainer="sliderTrackContainer";class ve extends n{name="slider";static 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}}};_isHorizontal=!0;_innerView;_startHandler=null;_endHandler=null;_startHandlerText=null;_endHandlerText=null;_railContainer;_rail;_track;_prePos;_currentHandler=null;_currentValue={};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({},ve.defaultAttributes,t))}setValue(t){const[e,s]=i.array(t),{layout:a,railWidth:n,railHeight:r,min:l,max:o}=this.attribute,{startHandler:h,endHandler:d}=this._getHandlers(),c="vertical"===a?r:n,u=(e-l)/(o-l)*c;if(h&&this._updateHandler(h,u,e),d){const t=(s-l)/(o-l)*c;this._updateHandler(d,t,s)}this._updateTrack()}render(){this.removeAllChild();const{layout:s="horizontal",railWidth:a,railHeight:n,startText:r,endText:l,min:o,max:h,showHandler:d=!0}=this.attribute;let{value:c}=this.attribute;i.isNil(c)&&(c=[o,h]),this._currentValue={startValue:xe(c)[0],endValue:xe(c)[1]};const u="horizontal"===s;this._isHorizontal=u;const p=e.createGroup({x:0,y:0});p.name=t.SLIDER_ELEMENT_NAME.innerView,this.add(p),this._innerView=p;let b,g=0;if(r&&r.visible){b=e.createText({x:u?0:a/2,y:u?n/2:0,textAlign:u?"start":"center",textBaseline:u?"middle":"top",text:r.text,lineHeight:r.style?.fontSize,...r.style}),b.name=t.SLIDER_ELEMENT_NAME.startText,p.add(b);const s=i.isValid(r.space)?r.space:0;g+=(u?b.AABBBounds.width():b.AABBBounds.height())+s}const _=e.createGroup({x:u?g:0,y:u?0:g});p.add(_);const y=e.createGroup({x:0,y:0});let m;if(y.name=t.SLIDER_ELEMENT_NAME.railContainer,this._railContainer=y,_.add(y),this._renderRail(y),g+=u?a:n,l&&l.visible){const s=i.isValid(l.space)?l.space:0;m=e.createText({x:u?g+s:a/2,y:u?n/2:g+s,textAlign:u?"start":"center",textBaseline:u?"middle":"top",text:l.text,lineHeight:l.style?.fontSize,...l.style}),m.name=t.SLIDER_ELEMENT_NAME.endText,p.add(m)}this._renderTrack(y),d&&(this._renderHandlers(_),this._bindEvents())}_renderRail(i){const{railWidth:s,railHeight:a,railStyle:n,slidable:r}=this.attribute;let l="default";!1!==r&&(l="pointer");const o=e.createRect({x:0,y:0,width:s,height:a,cursor:l,...n});return o.name=t.SLIDER_ELEMENT_NAME.rail,i.add(o),this._rail=o,o}_renderHandlers(e){const{range:s,min:a,max:n,handlerSize:r=14,handlerStyle:l,handlerText:o,railHeight:h,railWidth:d,slidable:c}=this.attribute;let{value:u}=this.attribute;i.isNil(u)&&(u=[a,n]);const p=o&&o.visible,b=this._isHorizontal,g=b?d:h,[_,y]=xe(u),m=(_-a)/(n-a)*g,x=this._renderHandler({x:b?m:d/2,y:b?h/2:m,size:r,strokeBoundsBuffer:0,cursor:!1===c?"default":fe(b),...l});if(x.name=t.SLIDER_ELEMENT_NAME.startHandler,this._startHandler=x,e.add(x),this._currentValue.startPos=m,p){const i=this._renderHandlerText(_);i.name=t.SLIDER_ELEMENT_NAME.startHandlerText,e.add(i),this._startHandlerText=i}if(s){const i=(y-a)/(n-a)*g,s=this._renderHandler({x:b?i:d/2,y:b?h/2:i,size:r,strokeBoundsBuffer:0,cursor:!1===c?"default":fe(b),...l});if(s.name=t.SLIDER_ELEMENT_NAME.endHandler,this._endHandler=s,e.add(s),this._currentValue.endPos=i,p){const i=this._renderHandlerText(y);i.name=t.SLIDER_ELEMENT_NAME.endHandlerText,e.add(i),this._endHandlerText=i}}}_renderTrack(s){const{range:a,min:n,max:r,railHeight:l,railWidth:o,trackStyle:h,railStyle:d,slidable:c}=this.attribute;let{value:u}=this.attribute;i.isNil(u)&&(u=[n,r]);const p=this._isHorizontal,b=p?o:l;let[g,_]=xe(u);a||(g=n);const y=e.createGroup({x:0,y:0,width:o,height:l,cornerRadius:d?.cornerRadius,clip:!0,pickable:!1});y.name=t.SLIDER_ELEMENT_NAME.trackContainer;const m=i.isObject(a)&&!0===a.draggableTrack;let x;x=!1===c?"default":!1===a||!1===m?"pointer":fe(p);const f=(_-g)/(r-n)*b,v=e.createRect({x:p?(g-n)/(r-n)*b:0,y:p?0:(g-n)/(r-n)*b,width:p?f:o,height:p?l:f,cursor:x,...h});v.name=t.SLIDER_ELEMENT_NAME.track,this._track=v,y.add(v),s.add(y)}_renderHandler(t){return e.createSymbol(t)}_renderHandlerText(t){const{align:i,min:s,max:a,handlerSize:n=14,handlerText:r={},railHeight:l,railWidth:o,slidable:h}=this.attribute,d=this._isHorizontal,c=(t-s)/(a-s)*(d?o:l),u=r.space??4,p={text:r?.formatter?r.formatter(t):t.toFixed(r?.precision??0),lineHeight:r.style?.lineHeight,cursor:!1===h?"default":fe(d),...r.style};d?"top"===i?(p.textBaseline="bottom",p.textAlign="center",p.x=c,p.y=(l-n)/2-u):(p.textBaseline="top",p.textAlign="center",p.x=c,p.y=(l+n)/2+u):"left"===i?(p.textBaseline="middle",p.textAlign="end",p.x=(o-n)/2-u,p.y=c):(p.textBaseline="middle",p.textAlign="start",p.x=(o+n)/2+u,p.y=c);return e.createText(p)}_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))}_onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===e.global.env?(e.global.addEventListener("pointermove",this._onHandlerPointerMove),e.global.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))};_onHandlerPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:s,min:a,max:n}=this.attribute;let r,l,o,h=0;this._isHorizontal?(r=t.clientX,h=r-this._prePos,l=this._currentHandler?.attribute.x,o=e):(r=t.clientY,h=r-this._prePos,l=this._currentHandler?.attribute.y,o=s);const d=i.clamp(l+h,0,o),c=d/o*(n-a)+a;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,c):this._updateHandler(this._currentHandler,d,c),this._updateTrack(),this._prePos=r,this._dispatchChangeEvent()};_onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===e.global.env)e.global.removeEventListener("pointermove",this._onHandlerPointerMove),e.global.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}};_onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===e.global.env?(e.global.addEventListener("pointermove",this._onTrackPointerMove),e.global.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))};_onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:s,min:a,max:n}=this.attribute,{startHandler:r,endHandler:l}=this._getHandlers();let o,h,d;this._isHorizontal?(o=t.clientX,h=this._track.attribute.width,d=e):(o=t.clientY,h=this._track.attribute.height,d=s);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=i.clamp(t+c,0,d-h),s=e/d*(n-a)+a;this._updateHandler(r,e,s)}if(l){const t=this._isHorizontal?l.attribute.x:l.attribute.y,e=i.clamp(t+c,h,d),s=e/d*(n-a)+a;this._updateHandler(l,e,s),this._track.setAttributes(this._isHorizontal?{x:Math.min(r?.attribute.x,l?.attribute.x),width:Math.abs(r?.attribute.x-l?.attribute.x)}:{y:Math.min(r?.attribute.y,l?.attribute.y),height:Math.abs(r?.attribute.y-l?.attribute.y)})}this._prePos=o,this._dispatchChangeEvent()};_onTrackPointerUp=t=>{t.preventDefault(),"browser"===e.global.env?(e.global.removeEventListener("pointermove",this._onTrackPointerMove),e.global.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))};_onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:s,min:a,max:n}=this.attribute,r=this._startHandler,l=this._endHandler;let o,h,d,c;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,h=r?.attribute.x,d=l?.attribute.x,c=e):(o=t.viewY-this._rail.globalAABBBounds.y1,h=r?.attribute.y,d=l?.attribute.y,c=s);const u=o/c*(n-a)+a;if(i.isValid(d)){const t=Math.abs(o-h)>Math.abs(o-d)?l:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()};_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=t?.attribute.x;if(e){const t=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=t?.attribute.y;if(e){const t=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){const a=this._isHorizontal;e.setAttribute(a?"x":"y",i);const n=e.name===t.SLIDER_ELEMENT_NAME.startHandler?this._startHandlerText:this._endHandlerText;if(n){const{handlerText:t}=this.attribute;n?.setAttributes({text:t?.formatter?t.formatter(s):s.toFixed(t?.precision??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){const a=this._isHorizontal,{handlerText:n}=this.attribute;e.setAttributes({[a?"x":"y"]:i,text:n?.formatter?n.formatter(s):s.toFixed(n?.precision??0)});const r=e.name===t.SLIDER_ELEMENT_NAME.startHandlerText?this._startHandler:this._endHandler;r&&r?.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(){const t=!!this.attribute.range,i=this._currentValue,s=new e.CustomEvent("change",{value:t?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:t?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});s.manager=this.stage?.eventSystem.manager,this.dispatchEvent(s)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<e?.attribute.x&&(t=e,e=i,i=t):i&&i.attribute.y<e?.attribute.y&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}}class Ae extends ge{name="colorLegend";static defaultAttributes={layout:"horizontal",title:{align:"start",space:de,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"}}};_slider;_colorScale;_color;constructor(t){super(i.merge({},Ae.defaultAttributes,t))}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:a,align:n,min:r,max:l,value:o,railWidth:h,railHeight:d,showHandler:c=!0,handlerSize:u,handlerStyle:p,railStyle:b,trackStyle:g,startText:_,endText:y,handlerText:m,showTooltip:x,tooltip:f}=this.attribute,v=[],A=(l-r)/(t.length-1);for(let e=0;e<t.length;e++)v.push(r+A*e);this._colorScale=(new s.LinearScale).domain(v,!0).range(t),this._color=this._getTrackColor();const S=new ve({x:0,y:0,range:{draggableTrack:!0},slidable:e,layout:a,align:n,min:r,max:l,value:o,railWidth:h,railHeight:d,showHandler:c,handlerSize:u,handlerStyle:p,railStyle:b,trackStyle:{fill:this._color,...g},startText:_,endText:y,handlerText:m,showTooltip:x,tooltip:f});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",de):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 a=[];for(let e=0;e<s;e++){const i=e/(s-1);a.push({offset:i,color:t[e]})}const n="horizontal"===e;return{gradient:"linear",stops:a,x0:0,y0:0,x1:n?1:0,y1:n?0:1}}_onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)};_updateColor(){const{layout:t="horizontal",colors:e,railWidth:i,railHeight:s}=this.attribute,{startHandler:a,endHandler:n,track:r}=this._slider,{startValue:l,endValue:o,startPos:h,endPos:d}=this._slider.currentValue,c=this._colorScale.scale(l),u=this._colorScale.scale(o);a?.setAttribute("fill",c),n?.setAttribute("fill",u);const p="horizontal"===t?i:s;if(Math.abs(h-d)!==p&&e&&e.length>1){const t=this._color.stops,e=Math.min(h,d),i=Math.max(h,d),s=e/p,a=i/p,n=a-s,c=t.filter((t=>t.offset>s&&t.offset<a)),u=Math.min(l,o),b=Math.max(l,o),g=this._colorScale.scale(u),_=this._colorScale.scale(b),y=[{offset:0,color:g}];c.forEach((t=>{y.push({offset:(t.offset-s)/n,color:t.color})})),y.push({offset:1,color:_}),r.setAttribute("fill",{...this._color,stops:y})}}}function Se(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`}class Ee extends ge{name="sizeLegend";static defaultAttributes={layout:"horizontal",title:{align:"start",space:de,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)"}};_slider;constructor(t){super(i.merge({},Ee.defaultAttributes,t))}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:s,align:a,min:n,max:r,value:l,railWidth:o,railHeight:h,showHandler:d=!0,handlerSize:c,handlerStyle:u,railStyle:p,trackStyle:b,startText:g,endText:_,handlerText:y,showTooltip:m,tooltip:x,sizeBackground:f}=this.attribute,v=e.createGroup({x:0,y:0});this._innerView.add(v);const A=new ve({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:s,align:a,min:n,max:r,value:l,railWidth:o,railHeight:h,showHandler:d,handlerSize:c,handlerStyle:{symbolType:Se(a),...u},railStyle:p,trackStyle:b,startText:g,endText:_,handlerText:y,showTooltip:m,tooltip:x});v.add(A);let S,E=0;const k=12;"horizontal"===s?"top"===a?(S=`M0,0L${o},0L${o},12Z`,E=h):(S=`M0,12L${o},12L${o},0Z`,A.setAttribute("y",k)):"left"===a?S=`M${o},0L${o},0L${o+k},${h}L${o},${h}Z`:(S=`M0,${h}L12,${h}L12,0Z`,A.setAttribute("x",k));const L=e.createPath({x:0,y:E,path:S,...f,zIndex:0});v.add(L);const B=this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",de):0;v.translate(0-v.AABBBounds.x1,B-v.AABBBounds.y1),this._slider=A}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}_onSliderChange=t=>{this.dispatchEvent(t)}}class ke extends n{name="title";_mainTitle;_subTitle;static 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"}};constructor(t){super(i.merge({},ke.defaultAttributes,t))}render(){const{text:t,textStyle:e,subtext:s,subtextStyle:a,width:n,height:r,minWidth:l,maxWidth:o,minHeight:h,maxHeight:d,align:c,verticalAlign:u,padding:p=0}=this.attribute,b=i.normalizePadding(p),g=this.createOrUpdateChild("title-container",{x:b[3],y:b[0],zIndex:1},"group");if(!1!==this.attribute?.visible&&!1!==e?.visible)if(e&&i.isValid(e?.character)){const t={x:e.x??0,y:e.y??0,width:e.width??n??0,height:e.height??r??0,ellipsis:e.ellipsis??!0,wordBreak:e.wordBreak??"break-word",maxHeight:e.maxHeight,maxWidth:e.maxWidth,textConfig:e.character};this._mainTitle=g.createOrUpdateChild("mainTitle",t,"richtext")}else i.isValid(t)&&(this._mainTitle=g.createOrUpdateChild("mainTitle",{text:[t],...e,maxLineWidth:e?.maxLineWidth??n,heightLimit:e?.heightLimit,lineClamp:e?.lineClamp,ellipsis:e?.ellipsis??!0,x:0,y:0},"wrapText"));const _=this._mainTitle?this._mainTitle?.AABBBounds.height():0,y=this._mainTitle?this._mainTitle?.AABBBounds.width():0;if(!1!==this.attribute?.visible&&!1!==a?.visible)if(a&&i.isValid(a?.character)){const t={x:a.x??0,y:a.y??_,width:a.width??n??0,height:a.height??r??0,ellipsis:a.ellipsis??!0,wordBreak:a.wordBreak??"break-word",maxHeight:a.maxHeight,maxWidth:a.maxWidth,textConfig:a.character};this._subTitle=g.createOrUpdateChild("subTitle",t,"richtext")}else i.isValid(s)&&(this._subTitle=g.createOrUpdateChild("subTitle",{text:[s],...a,maxLineWidth:a?.maxLineWidth??n,heightLimit:a?.heightLimit,lineClamp:a?.lineClamp,ellipsis:a?.ellipsis??!0,x:0,y:_},"wrapText"));const m=this._subTitle?this._subTitle?.AABBBounds.height():0,x=this._subTitle?this._subTitle?.AABBBounds.width():0;let f=Math.max(y,x),v=_+(a?.height??m);if(i.isValid(n)&&(f=n,this._mainTitle?.setAttribute("maxLineWidth",n),this._subTitle?.setAttribute("maxLineWidth",n)),i.isValid(r)&&(v=r),i.isValid(l)&&f<l&&(f=l),i.isValid(o)&&(this._mainTitle?.setAttribute("maxLineWidth",o),this._subTitle?.setAttribute("maxLineWidth",o),this._mainTitle?.setAttribute("maxWidth",o),this._subTitle?.setAttribute("maxWidth",o),f>o&&(f=o)),i.isValid(h)&&v<h&&(v=h),i.isValid(d)&&(this._mainTitle?.setAttribute("maxHeight",d),this._subTitle?.setAttribute("maxHeight",d-_),v>d&&(v=d)),g.attribute.width=f+b[1]+b[3],g.attribute.height=v+b[0]+b[2],i.isValid(c)||i.isValid(e?.align)){const t=e?.align?e?.align:c,i=e?.width??y;"left"===t?(this._mainTitle?.setAttribute("x",0),this._mainTitle?.setAttribute("textAlign","left")):"center"===t?(this._mainTitle?.setAttribute("x",i/2),this._mainTitle?.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle?.setAttribute("x",i),this._mainTitle?.setAttribute("textAlign","right"))}if(i.isValid(u)||i.isValid(e?.verticalAlign)){const t=e?.verticalAlign?e?.verticalAlign:u,i=e?.height?e?.height:f;"top"===t?(this._mainTitle?.setAttribute("y",0),this._mainTitle?.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle?.setAttribute("y",i/2),this._mainTitle?.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle?.setAttribute("y",i),this._mainTitle?.setAttribute("textBaseline","bottom"))}if(i.isValid(c)||i.isValid(a?.align)){const t=a?.align?a?.align:c,e=a?.width??x;"left"===t?(this._subTitle?.setAttribute("x",0),this._subTitle?.setAttribute("textAlign","left")):"center"===t?(this._subTitle?.setAttribute("x",e/2),this._subTitle?.setAttribute("textAlign","center")):"right"===t&&(this._subTitle?.setAttribute("x",e),this._subTitle?.setAttribute("textAlign","right"))}if(i.isValid(u)||i.isValid(e?.verticalAlign)){const t=a?.verticalAlign?a?.verticalAlign:u,e=_,i=a?.height??0;"top"===t?(this._subTitle?.setAttribute("y",e),this._subTitle?.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle?.setAttribute("y",e+i/2),this._subTitle?.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle?.setAttribute("y",e+i),this._subTitle?.setAttribute("textBaseline","bottom"))}}}const Le={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 Be=(t,e)=>{let i=t.x0,s=t.x1;const a="number"==typeof e?t.thickness*e:t.thickness;let n=t.y0-t.thickness/2,r=t.y1-t.thickness/2;"center"===t.align?(n=t.y0-a/2,r=t.y1-a/2):"end"===t.align&&(n=t.y0+t.thickness/2-a,r=t.y1+t.thickness/2-a);let l=(i+s)/2,o=n+a,h=r+a;t.round&&(i=Math.round(i),s=Math.round(s),n=Math.round(n),r=Math.round(r),o=Math.round(o),h=Math.round(h),l=Math.round(l));const d=Math.abs(s-i)>1e-6,c=t.endArrow&&d?`L${s},${r-a/2}L${s+a},${(r+h)/2}L${s},${h+a/2}`:"",u=t.startArrow&&d?`L${i},${o+a/2}L${i-a},${(n+o)/2}L${i},${n-a/2}`:"";return!1===t.isSmooth?`M${i},${n}L${s},${r}${c}L${s},${h}L${i},${o}${u}Z`:`M${i},${n}\n C${l},${n},${l},${r},${s},${r}\n ${c}\n L${s},${h}\n C${l},${h},${l},${o},${i},${o}\n ${u}\n Z`},Me=(t,e)=>{let i=t.y0,s=t.y1,a=t.x0-t.thickness/2,n=t.x1-t.thickness/2;const r="number"==typeof e?t.thickness*e:t.thickness;"center"===t.align?(a=t.x0-r/2,n=t.x1-r/2):"end"===t.align&&(a=t.x0+t.thickness/2-r,n=t.x1+t.thickness/2-r);let l=(i+s)/2,o=a+r,h=n+r;t.round&&(i=Math.round(i),s=Math.round(s),a=Math.round(a),n=Math.round(n),o=Math.round(o),h=Math.round(h),l=Math.round(l));const d=Math.abs(s-i)>1e-6,c=t.endArrow&&d?`L${n-r/2},${s}L${(n+h)/2},${s+r}L${h+r/2},${s}`:"",u=t.startArrow&&d?`L${o+r/2},${i}L${(o+a)/2},${i-r}L${a-r/2},${i}`:"";return!1===t.isSmooth?`M${a},${i}L${n},${s}${c}L${h},${s}L${o},${i}${u}Z`:`M${a},${i}\n C${a},${l},${n},${l},${n},${s}\n ${c}\n L${h},${s}\n C${h},${l},${o},${l},${o},${i}\n ${u}\n Z`};class we extends n{static defaultAttributes={direction:"horizontal",align:"start"};_container;_backPath;_frontPath;constructor(t){super(i.merge({},we.defaultAttributes,t))}render(){const{direction:t="horizontal"}=this.attribute,e="vertical"===t?Me:Be,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"],a={};if(Object.keys(this.attribute).forEach((t=>{s.includes(t)||(a[t]=this.attribute[t])})),i){const t=this.createOrUpdateChild("sankey-link-background",Object.assign({},a,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 n=this.createOrUpdateChild("sankey-link-front",Object.assign({},a,{path:e(this.attribute,i?this.attribute.ratio:1),pickable:!1}),"path");this._frontPath=n}}class Te extends e.Symbol{constructor(t){super(t)}}var Ce,Pe;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(Ce||(Ce={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(Pe||(Pe={}));class Ie extends n{static defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"};static defaultAttributes={visible:!0,[Pe.Start]:{},[Pe.Pause]:{},[Pe.Backward]:{},[Pe.Forward]:{}};_isPaused=!0;_playController;_forwardController;_backwardController;_layout;_startAttr;_pauseAttr;_forwardAttr;_backwardAttr;constructor(t){super(i.merge({},Ie.defaultAttributes,t)),this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}updateAttributes=()=>{this._startAttr={style:{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",...Ie.defaultControllerAttr,...this.attribute.start.style}},this._pauseAttr={style:{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",...Ie.defaultControllerAttr,...this.attribute.pause.style}},this._forwardAttr={style:{...Ie.defaultControllerAttr,...this.attribute.forward.style}},this._backwardAttr={style:{...Ie.defaultControllerAttr,...this.attribute.backward.style}},this.updateLayout()};updateLayout=()=>{this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=this._backwardAttr.style?.symbolType??"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=this._forwardAttr.style?.symbolType??"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=this._backwardAttr.style?.symbolType??"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=this._forwardAttr.style?.symbolType??"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")};_initPlay=()=>{i.isNil(this._playController)&&(this._playController=new Te({...this._startAttr.style}),this.add(this._playController))};_initBackward=()=>{i.isNil(this._backwardController)&&(this._backwardController=new Te({...this._backwardAttr.style}),this.add(this._backwardController))};_initForward=()=>{i.isNil(this._forwardController)&&(this._forwardController=new Te({...this._forwardAttr.style}),this.add(this._forwardController))};_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()}))};_createCustomEvent=t=>{const i=new e.CustomEvent(t,{eventType:t});return i.manager=this.stage?.eventSystem.manager,i};render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}renderPlay=()=>{this._isPaused?this._playController.setAttributes({symbolType:this._playController.getComputedAttribute("symbolType"),...this._startAttr.style}):this._playController.setAttributes({symbolType:this._playController.getComputedAttribute("symbolType"),...this._pauseAttr.style})};renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)};renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)};play=()=>{const t=this._createCustomEvent(Ce.OnPlay);this.dispatchEvent(t)};pause=()=>{const t=this._createCustomEvent(Ce.OnPause);this.dispatchEvent(t)};forward=()=>{const t=this._createCustomEvent(Ce.OnForward);this.dispatchEvent(t)};backward=()=>{const t=this._createCustomEvent(Ce.OnBackward);this.dispatchEvent(t)};togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0};togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1}}const He={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},ze=[200,10];var Ve,Re;t.DirectionEnum=void 0,(Ve=t.DirectionEnum||(t.DirectionEnum={})).Default="default",Ve.Reverse="reverse",t.PlayerEventEnum=void 0,(Re=t.PlayerEventEnum||(t.PlayerEventEnum={})).OnChange="onChange",Re.OnPlay="onPlay",Re.OnPause="onPause",Re.OnBackward="onBackward",Re.OnForward="onForward",Re.OnEnd="onEnd";const De=({direction:e,maxIndex:i,minIndex:s,dataIndex:a})=>(({direction:e,maxIndex:i,dataIndex:s})=>e===t.DirectionEnum.Default&&s===i)({direction:e,maxIndex:i,dataIndex:a})||(({direction:e,minIndex:i,dataIndex:s})=>e===t.DirectionEnum.Reverse&&s===i)({direction:e,minIndex:s,dataIndex:a}),Ne=({direction:e,maxIndex:i,minIndex:s,dataIndex:a})=>(({direction:e,minIndex:i,dataIndex:s})=>e===t.DirectionEnum.Default&&s===i)({direction:e,minIndex:s,dataIndex:a})||(({direction:e,maxIndex:i,dataIndex:s})=>e===t.DirectionEnum.Reverse&&s===i)({direction:e,maxIndex:i,dataIndex:a}),Oe=t=>"top"===t||"bottom"===t;class $e extends n{static defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:{...He,key:"start",position:"start",space:0},pause:{...He,key:"pause",position:"start"},forward:{...He,key:"forward",position:"end"},backward:{...He,key:"backward",position:"start"}}};_slider;_controller;_data=[];_minIndex;_maxIndex;_railStyle;_trackStyle;_handlerStyle;_start;_pause;_forward;_backward;_size;_orient;_layoutInfo={};constructor(t){super(i.merge({},$e.defaultAttributes,t)),this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){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._railStyle={...this.attribute?.slider?.railStyle},this._trackStyle={...this.attribute?.slider?.trackStyle},this._handlerStyle={...this.attribute?.slider?.handlerStyle},this._start={...this.attribute?.controller?.start},this._pause={...this.attribute?.controller?.pause},this._forward={...this.attribute?.controller?.forward},this._backward={...this.attribute?.controller?.backward}}_initLayoutInfo(){const t=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),e=t.filter((t=>"end"!==t.position)),s=t.filter((t=>"end"===t.position)),a=(Oe(this._orient)?this._railStyle.height:this._railStyle.width)??ze[1],n=t.reduce(((t,e)=>{const s=e.style.size,a=i.isNumber(s)?s:i.max(s[0],s[1]);return t+e.space+a}),0),r=(Oe(this._orient)?this._size?.width:this._size?.height)-n,l=r-this.attribute.slider.space,o=e.reduce(((t,e)=>{const{key:s,space:a,style:{size:n}}=e,r=i.isNumber(n)?n:i.max(n[0],n[1]);return this._layoutInfo[s]={...this._layoutInfo[s],size:r,x:Oe(this._orient)?t+a:(this._size.width-r)/2,y:Oe(this._orient)?(this._size.height-r)/2:t+a},t+a+r}),0);this._layoutInfo.slider={...this._layoutInfo.slider,size:l,x:Oe(this._orient)?o+this.attribute.slider.space:(this._size.width-a)/2,y:Oe(this._orient)?(this._size.height-a)/2:o+this.attribute.slider.space},s.reduce(((t,e)=>{const{key:s,space:a,style:{size:n}}=e,r=i.isNumber(n)?n:i.max(n[0],n[1]);return this._layoutInfo[s]={...this._layoutInfo[s],size:r,x:Oe(this._orient)?t+a:(this._size.width-r)/2,y:Oe(this._orient)?(this._size.height-r)/2:t+a},t+a+r}),o+r)}_updateSliderAttrs=()=>{let t;i.isValidNumber(this._handlerStyle.size)?t=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(t=i.max(this._handlerStyle.size[0],this._handlerStyle.size[1]));const e={min:this._minIndex,max:this._maxIndex,value:this.attribute.dataIndex??0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:i.isValidNumber(t)?t:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(Oe(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=this._railStyle.height??ze[1];e.layout="horizontal",e.railHeight=i,e.railWidth=t,e.x=this._layoutInfo.slider.x,e.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=this._railStyle.width??ze[1];e.layout="vertical",e.railWidth=i,e.railHeight=t,e.x=this._layoutInfo.slider.x,e.y=this._layoutInfo.slider.y}return e};_initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new ve(t),this.add(this._slider)};_updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return Oe(this._orient)?(t.layout="horizontal",t.start={style:{...t.start.style,x:this._layoutInfo.start.x,y:this._layoutInfo.start.y}},t.pause={style:{...t.pause.style,x:this._layoutInfo.start.x,y:this._layoutInfo.start.y}},t.backward={style:{...t.backward.style,x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y}},t.forward={style:{...t.forward.style,x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y}}):(t.layout="vertical",t.start={style:{...t.start.style,x:this._layoutInfo.start.x,y:this._layoutInfo.start.y}},t.pause={style:{...t.pause.style,x:this._layoutInfo.start.x,y:this._layoutInfo.start.y}},t.backward={style:{...t.backward.style,x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y}},t.forward={style:{...t.forward.style,x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y}}),t};_initController=()=>{const t=this._updateControllerAttrs();this._controller=new Ie(t),this.add(this._controller)};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){const s=new e.CustomEvent(t,{eventType:t,index:i,value:this._data[i]});s.manager=this.stage?.eventSystem.manager,this.dispatchEvent(s)}}var Ue;t.IOperateType=void 0,(Ue=t.IOperateType||(t.IOperateType={})).drawStart="drawStart",Ue.drawEnd="drawEnd",Ue.drawing="drawing",Ue.moving="moving",Ue.moveStart="moveStart",Ue.moveEnd="moveEnd",Ue.brushClear="brushClear";const We={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}},Fe=5,Ge={debounce:i.debounce,throttle:i.throttle};class Ye extends n{name="brush";static defaultAttributes=We;_container;_activeDrawState=!1;_cacheDrawPoints=[];_isDrawedBeforeEnd=!1;_activeMoveState=!1;_operatingMaskMoveDx=0;_operatingMaskMoveDy=0;_operatingMaskMoveRangeX=[-1/0,1/0];_operatingMaskMoveRangeY=[-1/0,1/0];_cacheMovePoint;_operatingMask;_brushMaskAABBBoundsDict={};_updateDragMaskCallback;constructor(t){super(i.merge({},Ye.defaultAttributes,t))}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",Ge[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:a=[],dx:n=0,dy:r=0}=s[t].attribute,l=a.map((t=>({x:t.x+n,y:t.y+r})));if(i.polygonContainPoint(l,e.x,e.y))return this._operatingMask=s[t],!0}return!1}_onBrushStart=t=>{if(this._outOfInteractiveRange(t))return;const e=this.attribute?.brushMoved??!0;this._activeMoveState=e&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)};_onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))};_onBrushEnd=e=>{const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?(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,this._operatingMask?.setAttribute("pickable",!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){this._cacheMovePoint=this.eventPosToStagePos(e),this._operatingMaskMoveDx=this._operatingMask.attribute.dx??0,this._operatingMaskMoveDy=this._operatingMask.attribute.dy??0;const{interactiveRange:i}=this.attribute,{minY:s=-1/0,maxY:a=1/0,minX:n=-1/0,maxX:r=1/0}=i,{x1:l,x2:o,y1:h,y2:d}=this._operatingMask.globalAABBBounds,c=n-l,u=r-o,p=s-h,b=a-d;this._operatingMaskMoveRangeX=[c,u],this._operatingMaskMoveRangeY=[p,b],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:t.IOperateType.moveStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(e){const i=this.eventPosToStagePos(e),{x1:s=0,x2:a=0,y1:n=0,y2:r=0}=this._operatingMask?._AABBBounds,{sizeThreshold:l=Fe}=this.attribute;if(this._isDrawedBeforeEnd=!!(Math.abs(a-s)>l||Math.abs(n-r)>l),this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(i.x===t?.x&&i.y===t?.y)return}this._cacheDrawPoints.push(i);const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o),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===i?.x&&s.y===i?.y)return;const a=s.x-i.x,n=s.y-i.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],a))+this._operatingMaskMoveDx,l=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+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 a=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return a="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:s[0]},{x:r.x,y:s[0]},{x:r.x,y:s[1]},{x:n.x,y:s[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:i.cloneDeep(this._cacheDrawPoints),a}_addBrushMask(){const{brushStyle:t}=this.attribute,s=e.createPolygon({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:a=-1/0,maxX:n=1/0}=e,r=this.eventPosToStagePos(t);return r.x>n||r.x<a||r.y>s||r.y<i}eventPosToStagePos(t){const e=this.stage?.window.getBoundingClientRect();return{x:t.clientX-(e?.left||0)-(this.stage?.x||0),y:t.clientY-(e?.top||0)-(this.stage?.y||0)}}render(){this.bindBrushEvents();const t=this.createOrUpdateChild("brush-container",{},"group");this._container=t}setUpdateDragMaskCallback(t){i.isFunction(t)&&(this._updateDragMaskCallback=t)}}const Xe=(t,...e)=>{const s=[t.shape,...e.map((t=>t?.shape))],a=[t.key,...e.map((t=>t?.key))],n=[t.value,...e.map((t=>t?.value))];return i.merge(t,...e,{shape:s.every(i.isNil)?void 0:i.merge({},...s),key:a.every(i.isNil)?void 0:i.merge({},...a),value:n.every(i.isNil)?void 0:i.merge({},...n)})},qe=t=>{const{width:e,height:s,wordBreak:a="break-word",textAlign:n,textBaseline:r,text:l}=t;return{width:e,height:s,wordBreak:a,textAlign:n,textBaseline:r,singleLine:!1,textConfig:i.array(l).map((e=>({...t,text:e})))}},Ze={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:x,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:x,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:x,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},je=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"],Je="tooltip-title",Ke="tooltip-content",Qe="shape",ti="value";class ei extends n{name="tooltip";_tooltipPanel;_tooltipTitleContainer;_tooltipTitleSymbol;_tooltipTitle;_tooltipContent;static defaultAttributes=Ze;constructor(t){super(i.merge({},ei.defaultAttributes,t))}render(){const{visible:t,content:e,panel:s,keyWidth:a,valueWidth:n,hasContentShape:r,autoCalculatePosition:l,autoMeasure:h}=this.attribute;if(!t)return void this.hideAll();h&&ei.measureTooltip(this.attribute),l&&ei.calculateTooltipPosition(this.attribute);const d=i.normalizePadding(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",{visible:!0,...s},"rect"),this._tooltipTitleContainer=this.createOrUpdateChild(Je,{visible:!0,x:d[3],y:d[0]},"group");const c=ei.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild(`${Je}-${Qe}`,i.merge({symbolType:"circle"},c.shape,{visible:o(c)&&o(c.shape)}),"symbol"),c.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild(`${Je}-${ti}`,{visible:o(c)&&o(c.value),...qe(c.value)},"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild(`${Je}-${ti}`,{text:"",visible:o(c)&&o(c.value),...c.value},"text");const u=o(c.shape)?c.shape.size+c.shape.spacing:0,{textAlign:p,textBaseline:b}=c.value,g=s.width-d[3]-d[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+g/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+g):this._tooltipTitle.setAttribute("x",u),"bottom"===b?this._tooltipTitle.setAttribute("y",c.height):"middle"===b?this._tooltipTitle.setAttribute("y",c.height/2):this._tooltipTitle.setAttribute("y",0);const _=o(c)?c.height+c.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild(Ke,{visible:!0},"group"),this._tooltipContent.removeAllChild(),e?.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let t=0;e.forEach(((e,s)=>{const l=ei.getContentAttr(this.attribute,s);if(!o(l))return;const h=`${Ke}-${s}`,d=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:t},"group");let c=0;if(o(l.shape)&&d.createOrUpdateChild(`${h}-${Qe}`,{visible:!0,x:l.shape.size/2,y:l.shape.size/2+((l.key.lineHeight??l.key.fontSize)-l.shape.size)/2,...l.shape},"symbol"),r&&(c+=l.shape.size+l.shape.spacing),o(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${h}-key`,{visible:!0,...qe(l.key),textBaseline:"top"},"richtext"):d.createOrUpdateChild(`${h}-key`,{visible:!0,...l.key,textBaseline:"top"},"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",c+a/2):"right"===e||"end"===e?t.setAttribute("x",c+a):t.setAttribute("x",c),t.setAttribute("y",0),c+=a+l.key.spacing}if(o(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${h}-${ti}`,{visible:!0,...qe(l.value),textBaseline:"top"},"richtext"):d.createOrUpdateChild(`${h}-${ti}`,{visible:!0,...l.value,textBaseline:"top"},"text");let e="right";i.isValid(l.value.textAlign)?e=l.value.textAlign:o(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",c+n/2):"right"===e||"end"===e?t.setAttribute("x",c+n):t.setAttribute("x",c),c+=n,t.setAttribute("y",0),d.add(t)}t+=l.height+l.spaceRow}))}}setAttributes(t,e){const s=Object.keys(t);this.attribute.autoCalculatePosition&&s.every((t=>je.includes(t)))?(this._mergeAttributes(t,s),i.isNil(this.attribute.panel.width)&&this.attribute.autoMeasure&&ei.measureTooltip(this.attribute),ei.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:a,pointerX:n,pointerY:r,positionX:l,positionY:o,parentBounds:h}=t;let d=n,c=r;return"left"===l?d-=e+s:"center"===l?d-=e/2:d+=s,"top"===o?c-=i+a:"middle"===o?c-=i/2:c+=a,d+e>h.x2&&(d-=e+s),c+i>h.y2&&(c-=i+a),d<h.x1&&(d=h.x1),c<h.y1&&(c=h.y1),t.x=d,t.y=c,t}static measureTooltip(t){const{content:s,contentStyle:a}=t,n=i.normalizePadding(t.padding),r=ei.getTitleAttr(t);let l=0,h=n[0]+n[2],d=0;const{value:c,shape:u}=r,{visible:p=!1,symbolType:b=""}=u??{};if(i.isValid(c)){const{width:t,height:e}=A(c).quickMeasure(c.text);l=t,d=e}if(p&&e.builtinSymbolsMap[b]&&(l+=u.size+u.spacing,d=Math.max(u.size,d)),t.title&&(t.title.width=l,t.title.height=d),o(r)&&(h+=d+r.spaceRow),s?.length){const i=[];if(s.forEach(((e,s)=>{const a=ei.getContentAttr(t,s);(e.key||e.value)&&o(a)&&i.push([e,a])})),i.length){let n=!1;const r=[],d=[],c=[];i.forEach((([t,s],l)=>{const{key:u,value:p,shape:b,spaceRow:g}=s,_=o(b),y=b?.symbolType??"",m=A(u),x=A(p);let f=0;if(o(u)){const{width:t,height:e}=m.quickMeasure(u.text);d.push(t),f=Math.max(f,e)}if(o(p)){const{width:t,height:e}=x.quickMeasure(p.text);c.push(t),f=Math.max(f,e)}_&&e.builtinSymbolsMap[y]&&(n=!0,r.push(b.size),f=Math.max(b.size,f)),t.height=f,h+=f,l<i.length-1&&(h+=g??a.spaceRow)}));const u=r.length?Math.max(...r):0,p=d.length?Math.max(...d):0,b=c.length?Math.max(...c):0;l=Math.max(p+b+a.key.spacing+a.value.spacing+(n?u+a.shape.spacing:0),l),s.forEach((t=>{t.width=l})),t.hasContentShape=n,t.keyWidth=p,t.valueWidth=b}}return t.panel.width=l+n[1]+n[3],t.panel.height=h,t}static getTitleAttr(t){return Xe({},ei.defaultAttributes.titleStyle,ei.defaultAttributes.title,t.titleStyle,t.title)}static getContentAttr(t,e){return Xe({},ei.defaultAttributes.contentStyle,t.contentStyle,t.content[e])}}t.AbstractComponent=n,t.ArcInfo=yt,t.ArcLabel=mt,t.BasePlayer=$e,t.Brush=Ye,t.CircleAxis=Ot,t.CircleCrosshair=$,t.ColorContinuousLegend=Ae,t.ContinuousPlayer=class extends $e{_dataIndex;_activeIndex;_alternate;_interval;_totalDuration;_isPlaying=!1;_startTime=Date.now();_elapsed;_rafId;constructor(t){super(t),this._initAttributes(),this._initEvents()}_initAttributes=()=>{super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=this.attribute.interval??1e3,this._dataIndex=this.attribute.dataIndex??this._minIndex;const t=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(t??1)):(this._totalDuration=this._interval*t,this._interval=this.attribute.interval)};_initEvents=()=>{this._controller.addEventListener(Ce.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(Ce.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(Ce.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(Ce.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{t.stopPropagation();const e=t.detail?.value,i=e/this._maxIndex;this._elapsed=i*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(e)}))};_getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)};_updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))};_dispatchChange=e=>{const i=Math.floor(e);i!==this._activeIndex&&(this._dataIndex=i,this._activeIndex=i,i!==this._maxIndex&&this.dispatchCustomEvent(t.PlayerEventEnum.OnChange))};dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}play=async()=>{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.OnPlay),this._rafId=e.global.getRequestAnimationFrame()(this._play.bind(this)))};_play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=e.global.getRequestAnimationFrame()(this._play.bind(this))};_playEnd=()=>{this._isPlaying=!1,e.global.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(t.PlayerEventEnum.OnEnd)};pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,e.global.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(t.PlayerEventEnum.OnPause))};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.OnBackward)};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.OnForward)};render(){super.render()}},t.DEFAULT_ITEM_SPACE_COL=oe,t.DEFAULT_ITEM_SPACE_ROW=he,t.DEFAULT_LABEL_SPACE=8,t.DEFAULT_PAGER_SPACE=ce,t.DEFAULT_SHAPE_SIZE=10,t.DEFAULT_SHAPE_SPACE=8,t.DEFAULT_STATES=Mt,t.DEFAULT_TITLE_SPACE=de,t.DEFAULT_VALUE_SPACE=8,t.DataLabel=ft,t.DataZoom=Yt,t.DiscreteLegend=ye,t.DiscretePlayer=class extends $e{_dataIndex;_activeIndex=-1;_alternate;_interval;_isPlaying;_direction;_tickTime;_rafId;_isReachEnd=!1;constructor(t){super(i.merge({},t)),this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}_initAttributes=()=>{super._initAttributes(),this._alternate=this.attribute.alternate??!1,this._interval=this.attribute.interval??1e3,this._direction=this.attribute.direction??t.DirectionEnum.Default,this._dataIndex=i.isNil(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:this.attribute.dataIndex??0,this._slider.setAttribute("value",this._dataIndex)};_initEvents=()=>{this._controller.addEventListener(Ce.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(Ce.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(Ce.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(Ce.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.OnChange)}))};dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}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})||Ne({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.OnPlay),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=e.global.getRequestAnimationFrame()(this._play.bind(this,!0)))};_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.OnChange),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.OnChange)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=e.global.getRequestAnimationFrame()(this._play.bind(this,!1))};_updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)};_playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),e.global.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(t.PlayerEventEnum.OnEnd)};pause=()=>{this._isPlaying&&(this._isPlaying=!1,e.global.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(t.PlayerEventEnum.OnPause))};backward=()=>{const e=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(e),this.dispatchCustomEvent(t.PlayerEventEnum.OnChange),this.dispatchCustomEvent(t.PlayerEventEnum.OnBackward)};forward=()=>{const e=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(e),this.dispatchCustomEvent(t.PlayerEventEnum.OnChange),this.dispatchCustomEvent(t.PlayerEventEnum.OnForward)}},t.Grid=Et,t.GroupFadeIn=Ut,t.GroupFadeOut=Wt,t.GroupTransition=$t,t.Indicator=class extends n{name="indicator";_title;_content;render(){const{visible:t,title:e,content:s,size:a,limitRatio:n=1/0}=this.attribute,r=Math.min(a.width,a.height)*n,l=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==t)return void(l&&l.hideAll());if(i.isValid(e))if(!1!==e.visible){const t=i.merge({},i.get(Le,"title.style"),e.style);this._title=l.createOrUpdateChild("indicator-title",{...t,lineHeight:i.isValid(t.lineHeight)?t.lineHeight:t.fontSize,visible:e.visible,x:0,y:0},"text"),e.autoFit&&i.isValidNumber(r)&&this._setAutoFit(r,this._title,e),e.autoLimit&&i.isValidNumber(n)&&this._title.setAttribute("maxLineWidth",r)}else{const t=l.find((t=>"indicator-title"===t.name),!1);t&&l.removeChild(t),this._title=void 0}const o=this._title?this._title.AABBBounds.height():0;if(i.isValid(s)){const t=this._title&&e?.space?e.space:0,a=i.array(s),h=[];let d=0;a.forEach(((e,s)=>{if(!1!==e.visible){const a=i.merge({},i.get(Le,"content.style"),e.style),c=l.createOrUpdateChild("indicator-content-"+s,{...a,lineHeight:i.isValid(a.lineHeight)?a.lineHeight:a.fontSize,visible:e.visible,x:0,y:o+t+d},"text");e.autoFit&&i.isValidNumber(r)&&this._setAutoFit(r,c,e),e.autoLimit&&i.isValidNumber(n)&&c.setAttribute("maxLineWidth",r),h.push(c);const u=e?.space?e.space:0;d+=c.AABBBounds.height()+u}else{const t=l.find((t=>t.name==="indicator-content-"+s),!1);t&&l.removeChild(t)}})),this._content=h}const h=l?.AABBBounds.height()??0;l.setAttribute("y",a.height/2-h/2),l.setAttribute("x",a.width/2)}_setAutoFit(t,e,s){const a=S(s.style?.text??"",s.style??{}).width;if(a>0){const n=t*(s.fitPercent??.5)/a,r=Math.floor((s.style?.fontSize??20)*n);e.setAttribute("fontSize",r),e.setAttribute("lineHeight",i.isValid(s.style.lineHeight)?s.style.lineHeight:r)}}},t.LabelBase=ht,t.LineAxis=Nt,t.LineCrosshair=N,t.LineLabel=ut,t.LinkPath=we,t.MarkArea=ae,t.MarkLine=se,t.MarkPoint=ne,t.Pager=le,t.PolygonCrosshair=W,t.PopTip=k,t.RectCrosshair=O,t.RectLabel=ct,t.ScrollBar=r,t.SectorCrosshair=U,t.Segment=kt,t.SizeContinuousLegend=Ee,t.Slider=ve,t.SymbolLabel=dt,t.Tag=E,t.Title=ke,t.Tooltip=ei,t.getHorizontalPath=Be,t.getSizeHandlerPath=Se,t.getVerticalPath=Me,t.loadPoptip=function(t){i.merge(I.poptip,t),e.container.load(R)},t.popTipModule=R,t.setPoptipTheme=function(t){i.merge(I.poptip,P,t)},t.version="0.14.1-alpha.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 a=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class n 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.merge(this.attribute[t],e):this.attribute[t]=e,a.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=>a.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 a=e[s];i.isPlainObject(this.attribute[a])?i.merge(this.attribute[a],t[a]):this.attribute[a]=t[a]}}bindEvents(){}_getNodeId(t){return`${this.id}-${this.name}-${t}`}}class r extends n{constructor(t){super(i.merge({},r.defaultAttributes,t)),this.name="scrollbar",this._onRailPointerDown=t=>{var e,s;const{viewX:a,viewY:n}=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=n-this._viewPosition.y,e=i.clamp(t-h/2,u,c);b=t/o,this._slider.setAttribute("y",e,!0)}else{const t=a-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,a=0;const n=this.getScrollRange(),{width:r,height:l}=this._getSliderRenderBounds();"vertical"===e?(s=t.clientY,a=s-this._prePos,i=a/l):(s=t.clientX,a=s-this._prePos,i=a/r),this.setScrollRange([n[0]+i,n[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,a;const{direction:n="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"===n?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===(a=this.stage)||void 0===a||a.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:a,limitRange:n=[0,1],railStyle:r,sliderStyle:l,padding:o=2}=this.attribute,d=this.createOrUpdateChild("scrollbar-container",{},"group"),h=d.createOrUpdateChild("scrollbar-rail",{x:0,y:0,width:e,height:s,...r},"rect");this._rail=h;const u=this._getSliderRenderBounds(),c=this._getSliderPos(i.clampRange(a,n[0],n[1])),b=c[1]-c[0];let p;this._sliderSize=b,p="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 v=d.createOrUpdateChild("slider",{...p,cornerRadius:this._getDefaultSliderCornerRadius(),...l,boundsPadding:i.normalizePadding(o),pickMode:"imprecise"},"rect");this._slider=v,this._container=d;const g=this._container.AABBBounds;this._viewPosition={x:g.x1,y:g.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:s=2}=this.attribute,[a,n,r,l]=i.normalizePadding(s),o={x1:l,y1:a,x2:t-n,y2:e-r,width:t-(l+n),height:e-(a+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:a,y1:n}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+a,i*t[1]+a]:[s*t[0]+n,s*t[1]+n]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[s,a]=i.clampRange(t,0,1),{width:n,height:r,x1:l,y1:o}=this._getSliderRenderBounds(),d=this._sliderSize;return"horizontal"===e?i.clampRange([l+s*n,l+a*n],l,n-d):i.clampRange([o+s*r,o+a*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,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&l(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]};const o=t=>!i.isNil(t)&&!1!==t.visible;const d=["#ffffff","#000000"];function h(t,e,i,s,a){const n=p(t),r=p(e);return u(n,r,i,s)?n:function(t,e,i,s,a){const n=[];a&&(a instanceof Array?n.push(...a):n.push(a));n.push(...d);for(const a of n)if(t!==a&&u(a,e,i,s))return a;return}(n,r,i,s,a)}function u(t,e,i,s){return s?c(t,e)>s:"largeText"===i?c(t,e)>3:c(t,e)>4.5}function c(t,e){const i=b(t),s=b(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function b(t){const e=i.ColorUtil.hexToRgb(t),s=e[0]/255,a=e[1]/255,n=e[2]/255;let r,l,o;r=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),l=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4);return.2126*r+.7152*l+.0722*o}function p(t){if(null==t?void 0:t.includes("#"))return t;const e=new i.ColorUtil.Color(t),{r:s,g:a,b:n}=e.color;return"#"+i.ColorUtil.rgbToHex(s,a,n)}function v(t,e){return[t[0]*e,t[1]*e]}function g(t,e,i){const s=function(t,e){const[i,s]=t,[a,n]=e,r=Math.sqrt((i*i+s*s)*(a*a+n*n)),l=r&&(i*a+s*n)/r;return Math.acos(Math.min(Math.max(l,-1),1))}(t,e),a=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?a?2*Math.PI-s:s:a?s:2*Math.PI-s}const _=-.5*Math.PI,y=1.5*Math.PI,m="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 x;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(x||(x={}));const f={[x.selectedReverse]:{},[x.selected]:{},[x.hover]:{},[x.hoverReverse]:{}},A=(t,s,a)=>new i.TextMeasure({defaultFontParams:{fontFamily:m,fontSize:11},getTextBounds:a?void 0:e.getTextBounds,specialCharSet:"-/: .,@%'\"~"+i.TextMeasure.ALPHABET_CHAR_SET+i.TextMeasure.ALPHABET_CHAR_SET.toUpperCase(),...null!=s?s:{}},t);function S(t,i){var s,a;if(!t)return{width:0,height:0};const n=e.getTextBounds({text:t,fontFamily:null!==(s=i.fontFamily)&&void 0!==s?s:"",fontSize:i.fontSize||12,fontWeight:i.fontWeight,textAlign:null!==(a=i.textAlign)&&void 0!==a?a:"center",textBaseline:i.textBaseline,ellipsis:!!i.ellipsis,maxLineWidth:i.maxLineWidth||1/0,lineHeight:i.fontSize||12});return{width:n.width(),height:n.height()}}class E extends n{constructor(t){super(i.merge({},E.defaultAttributes,t)),this.name="tag"}render(){var t;const{text:e="",textStyle:s={},shape:a={},panel:n={},space:r=4,minWidth:l,maxWidth:o,padding:d=4,visible:h,state:u}=this.attribute,c=i.normalizePadding(d),b=this.createOrUpdateChild("tag-content",{x:0,y:0,zIndex:1},"group");let p,v=c[1]+c[3],g=c[0]+c[2],_=0,y=0;const{visible:m,...x}=a;if(i.isBoolean(m)){const t=(null==x?void 0:x.size)||10,e=i.isNumber(t)?t:Math.max(t[0],t[1]);p=b.createOrUpdateChild("tag-shape",{symbolType:"circle",size:t,strokeBoundsBuffer:0,...x,visible:m,x:e/2,y:e/2},"symbol"),i.isEmpty(null==u?void 0:u.shape)||(p.states=u.shape),m&&(y=e+r)}v+=y,_+=y;const f={text:e,visible:i.isValid(e)&&!1!==h,lineHeight:null==s?void 0:s.fontSize,...s,x:_,y:0};i.isNil(f.lineHeight)&&(f.lineHeight=f.fontSize);const A=b.createOrUpdateChild("tag-text",f,"text");i.isEmpty(null==u?void 0:u.text)||(A.states=u.text);const E=S(f.text,s),L=E.width,k=E.height;v+=L;const B=null!==(t=a.size)&&void 0!==t?t:10,M=i.isNumber(B)?B:Math.max(B[0],B[1]);g+=Math.max(k,(null==a?void 0:a.visible)?M:0);const{textAlign:w,textBaseline:T}=s;(i.isValid(l)||i.isValid(o))&&(i.isValid(l)&&v<l&&(v=l),i.isValid(o)&&v>o&&(v=o,A.setAttribute("maxLineWidth",o-c[1]-c[2])));let C=0,P=0;"center"===w?(C-=v/2,p&&p.setAttribute("x",(p.attribute.x||0)-L/2),b.setAttribute("x",-y/2)):"right"===w||"end"===w?(C-=v,p&&p.setAttribute("x",(p.attribute.x||0)-L),b.setAttribute("x",-c[1]-y)):"left"!==w&&"start"!==w||b.setAttribute("x",c[3]),"middle"===T?(P-=g/2,p&&p.setAttribute("y",0)):"bottom"===T?(P-=g,p&&p.setAttribute("y",-k/2),b.setAttribute("y",-c[2])):"top"===T&&(b.setAttribute("y",c[0]),p&&p.setAttribute("y",k/2));const{visible:I,...H}=n;if(h&&i.isBoolean(I)){const t=this.createOrUpdateChild("tag-panel",{...H,visible:I&&!!e,x:C,y:P,width:v,height:g},"rect");i.isEmpty(null==u?void 0:u.panel)||(t.states=u.panel)}}}E.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};class L extends n{constructor(t){super(i.merge({},L.defaultAttributes,t)),this.name="poptip",this.positionList=["top","tl","tr","bottom","bl","br","left","lt","lb","right","rt","rb"]}render(){var t,e,s,a,n;const{title:r="",titleStyle:l={},position:o,content:d="",contentStyle:h={},panel:u={},space:c=4,minWidth:b=0,maxWidth:p=1/0,padding:v=4,visible:g,state:_,dx:y=0,dy:m=0}=this.attribute,x=i.normalizePadding(v),f=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group"),A=p-x[1]-x[3],S=i.isValid(r)&&!1!==g,E={text:r,visible:S,...l,x:x[3],y:x[0],maxLineWidth:A,textAlign:"left",textBaseline:"top"},L=f.createOrUpdateChild("poptip-title",E,"text");i.isEmpty(null==_?void 0:_.title)||(L.states=_.title);const k=L.AABBBounds,B=k.height(),M=k.width();let w=B+c;S||(w=0);const T=i.isValid(d)&&!1!==g,C={text:d,visible:T,...h,x:x[3],y:x[0]+w,maxLineWidth:A,textAlign:"left",textBaseline:"top"},P=f.createOrUpdateChild("poptip-content",C,"text");i.isEmpty(null==_?void 0:_.content)||(P.states=_.content);const I=P.AABBBounds,H=I.height(),z=I.width();T&&(w+=H);let V=i.max(M+x[1]+x[3],z+x[1]+x[3]);V>p?V=p:V<b&&(V=b);const R=x[0]+x[2]+w,{visible:N,...D}=u,O=null!==(t=D.size)&&void 0!==t?t:12,$=i.isArray(O)?[O[0]+(null!==(e=D.space)&&void 0!==e?e:0),O[1]+(null!==(s=D.space)&&void 0!==s?s:0)]:O+(null!==(a=D.space)&&void 0!==a?a:0),U=null!==(n=D.lineWidth)&&void 0!==n?n:1,W=this.stage?[this.stage.width,this.stage.height]:void 0,F="auto"===o;let G,Y=1/0;for(let t=0;t<this.positionList.length+1;t++){const e=F?this.positionList[t===this.positionList.length?G:t]:o,{angle:s,offset:a,rectOffset:n}=this.getAngleAndOffset(e,V,R,i.isArray($)?$:[$,$-U]);if(i.isBoolean(N)){const t=(i.isArray(O)?O[0]:O)/4,e=f.createOrUpdateChild("poptip-symbol-panel",{...D,visible:N&&(T||S),x:t,y:0,strokeBoundsBuffer:-1,boundsPadding:-2,anchor:[0,0],symbolType:"arrow2Left",angle:s,dx:a[0],dy:a[1],size:O,zIndex:-9},"symbol");i.isEmpty(null==_?void 0:_.panel)||(e.states=_.panel);const n=f.createOrUpdateChild("poptip-rect-panel",{...D,visible:N&&(T||S),x:0,y:0,width:V,height:R,zIndex:-8},"rect");i.isEmpty(null==_?void 0:_.panel)||(n.states=_.panel)}if(f.setAttributes({x:-a[0]+y,y:-a[1]+m}),!F||!W)break;{const e=this.AABBBounds,s=(new i.Bounds).setValue(0,0,W[0],W[1]);if(i.rectInsideAnotherRect(e,s,!1))break;{const a=i.getRectIntersect(e,s,!1),n=(a.x2-a.x1)*(a.y2-a.y1);n<Y&&(Y=n,G=t)}}}}getAngleAndOffset(t,e,s,a){const n=a[1]/2;switch(t){case"tl":return{angle:i.pi/2*3,offset:[e/4,s+n],rectOffset:[-e/4,-s-a[1]]};case"top":return{angle:i.pi/2*3,offset:[e/2,s+n],rectOffset:[0,-s-a[1]]};case"tr":return{angle:i.pi/2*3,offset:[e/4*3,s+n],rectOffset:[e/4*3,-s-a[1]]};case"rt":return{angle:0,offset:[-n,s/5],rectOffset:[e/4*3,-s-a[1]]};case"right":return{angle:0,offset:[-n,s/2],rectOffset:[e/4*3,-s-a[1]]};case"rb":return{angle:0,offset:[-n,s/5*4],rectOffset:[e/4*3,-s-a[1]]};case"bl":return{angle:i.pi/2,offset:[e/4,-n],rectOffset:[-e/4,-s-a[1]]};case"bottom":return{angle:i.pi/2,offset:[e/2,-n],rectOffset:[0,-s-a[1]]};case"br":return{angle:i.pi/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-s-a[1]]};case"lt":return{angle:i.pi,offset:[e+n,s/5],rectOffset:[-e/4,-s-a[1]]};case"left":return{angle:i.pi,offset:[e+n,s/2],rectOffset:[0,-s-a[1]]};case"lb":return{angle:i.pi,offset:[e+n,s/5*4],rectOffset:[e/4*3,-s-a[1]]}}}}L.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"},space:8,padding:10};var k="inversify:paramtypes";function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}var M=0;var w=function(t){this.id=M++,this.registry=t};function T(){return function(t){if(Reflect.hasOwnMetadata(k,t))throw new Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(k,e,t),t}}function C(t,e,i,s){var a,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"===("undefined"==typeof Reflect?"undefined":B(Reflect))&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(r=(n<3?a(r):n>3?a(e,i,r):a(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}"function"==typeof SuppressedError&&SuppressedError;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}},I={poptip:i.merge({},P)};let H=class{render(t,e,s,a,n,r,l,o,d,h,u,c,b){var p,v,g;if(1===t._showPoptip){const{visible:e,visibleCb:s}=t.attribute.poptip||{};if(!1===e||s&&!1===s(t))return;this.poptipComponent||(this.poptipComponent=new L(t.attribute.poptip));let a=t.attribute.poptip||{};if("text"===t.type&&null==a.title&&null==a.content){const e={};v=e,g=a,i.merge(v,I.poptip,g),a=e,a.content=null!==(p=a.content)&&void 0!==p?p:t.attribute.text}const n=t.globalTransMatrix;this.poptipComponent.setAttributes({visibleAll:!0,pickable:!1,childrenPickable:!1,...a,x:n.e,y:n.f}),h.stage.tryInitInteractiveLayer();const r=h.stage.getLayer("_builtin_interactive");r&&r.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};H=C([T()],H);let z=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)}};z=C([T()],z);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=C([T()],V);const R=new w((t=>{t(H).toSelf().inSingletonScope(),t(e.InteractiveSubRenderContribution).toService(H),t(z).toSelf().inSingletonScope(),t(e.AutoEnablePlugins).toService(z),t(V).toSelf().inSingletonScope(),t(e.AutoEnablePlugins).toService(V)}));class N extends n{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class D extends N{constructor(t){super(i.merge({},D.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",{points:[e,i],...s},"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}D.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class O extends N{constructor(t){super(i.merge({},O.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",{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})}}O.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class $ extends N{constructor(t){super(i.merge({},$.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",{...e,outerRadius:i,...this.attribute,...s},"arc")}setLocation(t){const{center:e}=this.attribute,s=i.PointService.distancePP(t,e);this.setAttribute("radius",s)}}$.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class U extends N{constructor(t){super(i.merge({},U.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:a}=this.attribute,{startAngle:n,endAngle:r}=this.attribute;return t.createOrUpdateChild("crosshair-sector",{...e,outerRadius:i,innerRadius:s,startAngle:n,endAngle:r,...a},"arc")}setLocation(t){const{center:e,startAngle:s=_,endAngle:a=y}=this.attribute,n=a-s,r=i.radianToDegree(i.getAngleByPoint(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}U.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class W extends N{constructor(t){super(i.merge({},W.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:s,sides:a=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:l}=this.attribute,o=(l-r)%(2*Math.PI)==0,d=(l-r)/a;let h;for(let t=0;t<=a;t++){const n=r+d*t,l=i.polarToCartesian(e,s,n);0===t?h=`M${l.x},${l.y}`:h+=`L${l.x},${l.y}`,t===a&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",{path:h,...n},"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 F=5,G=31,Y=32,X=new Uint32Array(Y+1),q=new Uint32Array(Y+1);q[0]=0,X[0]=~q[0];for(let t=1;t<=Y;++t)q[t]=q[t-1]<<1|1,X[t]=~q[t];function Z(t,e,i=0){const s=Math.max(1,Math.sqrt(t*e/1e6)),a=~~((t+2*i+s)/s),n=~~((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+Y)/Y));function s(t,e){i[t]|=e}function a(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const a=s*t+e;return i[a>>>F]&1<<(a&G)},set:(e,i)=>{const a=i*t+e;s(a>>>F,1<<(a&G))},clear:(e,i)=>{const s=i*t+e;a(s>>>F,~(1<<(s&G)))},getRange:({x1:s,y1:a,x2:n,y2:r})=>{if(n<0||r<0||s>t||a>e)return!0;let l,o,d,h,u=r;for(;u>=a;--u)if(l=u*t+s,o=u*t+n,d=l>>>F,h=o>>>F,d===h){if(i[d]&X[l&G]&q[1+(o&G)])return!0}else{if(i[d]&X[l&G])return!0;if(i[h]&q[1+(o&G)])return!0;for(let t=d+1;t<h;++t)if(i[t])return!0}return!1},setRange:({x1:i,y1:a,x2:n,y2:r})=>{if(n<0||r<0||i>t||a>e)return;let l,o,d,h,u;for(;a<=r;++a)if(l=a*t+i,o=a*t+n,d=l>>>F,h=o>>>F,d===h)s(d,X[l&G]&q[1+(o&G)]);else for(s(d,X[l&G]),s(h,q[1+(o&G)]),u=d+1;u<h;++u)s(u,4294967295)},clearRange:({x1:e,y1:i,x2:s,y2:n})=>{let r,l,o,d,h;for(;i<=n;++i)if(r=i*t+e,l=i*t+s,o=r>>>F,d=l>>>F,o===d)a(o,q[r&G]|X[1+(l&G)]);else for(a(o,q[r&G]),a(d,X[1+(l&G)]),h=o+1;h<d;++h)a(h,0)},outOfBounds:({x1:i,y1:s,x2:a,y2:n})=>i<0||s<0||n>=e||a>=t,toImageData:s=>{const a=s.createImageData(t,e),n=a.data;for(let s=0;s<e;++s)for(let e=0;e<t;++e){const a=s*t+e,r=4*a,l=i[a>>>F]&1<<(a&G);n[r+0]=255*l,n[r+1]=255*l,n[r+2]=255*l,n[r+3]=31}return a}}}(a,n),r.ratio=s,r.padding=i,r.width=t,r.height=e,r}function j(t,e,s=!1){if(s){const{x1:s,x2:a,y1:n,y2:r}=e,l=i.clamp(s,0,t.width),o=i.clamp(a,0,t.width),d=i.clamp(n,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){const a=j(t,i);return!(s&&e.outOfBounds(a))&&!e.getRange(a)}function K(t,e){return!(!t||!e)&&e.encloses(t)}function Q(t,e,i,s=[],a=!0){for(let n=0;n<s.length;n++){const r=i.clone();if(r.setAttributes(s[n]),r.update(),J(t,e,j(t,r.AABBBounds),a))return e.setRange(j(t,r.AABBBounds,!0)),s[n]}return!1}function tt(t,e,s,a,n,r,l){var o,d,h;if("bound"===s.type||"position"===s.type){if(i.isFunction(l)){const d=((i.isFunction(s.position)?s.position(n.attribute):s.position)||function(t){if("rect"===t)return it;return et}(a.type)).map((t=>l(n.AABBBounds,r,t,a.offset)));return Q(t,e,n,d,null===(o=a.overlap)||void 0===o?void 0:o.clampForce)}return!1}if("moveY"===s.type){const r=(s.offset?i.isFunction(s.offset)?s.offset(n.attribute):s.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return Q(t,e,n,r,null===(d=a.overlap)||void 0===d?void 0:d.clampForce)}if("moveX"===s.type){const r=(s.offset?i.isFunction(s.offset)?s.offset(n.attribute):s.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return Q(t,e,n,r,null===(h=a.overlap)||void 0===h?void 0:h.clampForce)}return!1}const et=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],it=["top","inside-top","inside"];function st(t,e,i){const{x1:s,x2:a,y1:n,y2:r}=t.AABBBounds,l=Math.min(s,a),o=Math.max(s,a),d=Math.min(n,r),h=Math.max(n,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 at={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=at[e])||void 0===i?void 0:i.call(at,t))&&void 0!==s?s:{from:{},to:{}}}const rt="same-time",lt=300,ot="linear";class dt extends n{constructor(){super(...arguments),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||i.isEmpty(e.states)||(e.addState(x.hover,!0),l(this,(t=>{t===e||i.isEmpty(t.states)||t.addState(x.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(l(this,(t=>{i.isEmpty(t.states)||(t.removeState(x.hoverReverse),t.removeState(x.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void l(this,(t=>{i.isEmpty(t.states)||(t.removeState(x.selectedReverse),t.removeState(x.selected))}));i.isEmpty(e.states)||(e.addState(x.selected,!0),l(this,(t=>{t===e||i.isEmpty(t.states)||t.addState(x.selectedReverse,!0)})),this._lastSelect=e)}}setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}layoutArcLabels(t,e,i,s,a){return[]}render(){this._prepare();const{overlap:t,smartInvert:e,dataFilter:s,customLayoutFunc:a,customOverlapFunc:n}=this.attribute;let r,l=this.attribute.data;i.isFunction(s)&&(l=s(l)),i.isFunction(a)?r=a(l,(t=>this._idToGraphic.get(t.id))):(r=this.layout(l),i.isFunction(n)?r=n(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=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=[];if(e.forEach((t=>{"willRelease"!==t.releaseStatus&&s.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),this._baseMarks=s,!s||0===s.length)return;const{data:a}=this.attribute;if(a&&0!==a.length){this._idToGraphic||(this._idToGraphic=new Map);for(let t=0;t<s.length;t++){const e=a[t],n=s[t];e&&n&&(i.isValid(e.id)||(e.id=`vrender-component-${this.name}-${t}`),this._idToGraphic.set(e.id,n))}}}layout(t=[]){var e;const{textStyle:s={},position:a,offset:n}=this.attribute,r=[],l=[];for(let e=0;e<t.length;e++){const o=t[e],d=this._idToGraphic.get(o.id),h={fill:d.attribute.fill,...s,...o},u=this._createLabelText(h),c=this.getGraphicBounds(u);l.push(c);const b=this.getGraphicBounds(d,{x:o.x,y:o.y}),p=this.labeling(c,b,i.isFunction(a)?a(o):a,n);p&&(h.x=p.x,h.y=p.y,u.setAttributes(p),r.push(u))}if("arc"===this.attribute.type){const i=this.layoutArcLabels(a,this.attribute,Array.from(this._idToGraphic.values()),t,l);for(let s=0;s<t.length;s++){const a=t[s],n=i.find((t=>t.labelText===a.text)),l={x:n.labelPosition.x,y:n.labelPosition.y,angle:null!==(e=this.attribute.angle)&&void 0!==e?e:n.angle,labelLinePath:n.labelLinePath};r[s].setAttributes(l)}}return r}_overlapping(t){var e,s,a,n;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!==(a=null==o?void 0:o.AABBBounds.height())&&void 0!==a?a:0};if(0===d.width||0===d.height)return t;const{avoidBaseMark:h,strategy:u=[],hideOnHit:c=!0,clampForce:b=!0,avoidMarks:p=[]}=r,v=this._bmpTool||Z(d.width,d.height),g=this._bitmap||v.bitmap(),_=u.some((t=>"bound"===t.type));h&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&g.setRange(j(v,t.AABBBounds,!0))}))),p.length>0&&p.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&&g.setRange(j(v,t.AABBBounds,!0))})):t.AABBBounds&&g.setRange(j(v,t.AABBBounds,!0))}));for(let e=0;e<t.length;e++){if(!1===t[e].visible)continue;const i=t[e],s=this._idToGraphic.get(i.attribute.id);if(i.update(),J(v,g,i.AABBBounds,b)){if(!_){g.setRange(j(v,i.AABBBounds,!0)),l.push(i);continue}if(_&&(null==s?void 0:s.AABBBounds)&&K(i.AABBBounds,null==s?void 0:s.AABBBounds)){g.setRange(j(v,i.AABBBounds,!0)),l.push(i);continue}}if(b){const{dx:t=0,dy:e=0}=st(i,v.width,v.height);if((0!==t||0!==e)&&J(v,g,{x1:i.AABBBounds.x1+t,x2:i.AABBBounds.x2+t,y1:i.AABBBounds.y1+e,y2:i.AABBBounds.y2+e})){i.setAttributes({x:i.attribute.x+t,y:i.attribute.y+e}),l.push(i);continue}}let a=!1;for(let n=0;n<u.length;n++)if(a=tt(v,g,u[n],this.attribute,i,this.getGraphicBounds(s,t[e]),this.labeling),!1!==a){i.setAttributes({x:a.x,y:a.y}),l.push(i);break}if(!a&&b){const{dx:t=0,dy:e=0}=st(i,v.width,v.height);if((0!==t||0!==e)&&J(v,g,{x1:i.AABBBounds.x1+t,x2:i.AABBBounds.x2+t,y1:i.AABBBounds.y1+e,y2:i.AABBBounds.y2+e})){i.setAttributes({x:i.attribute.x+t,y:i.attribute.y+e}),g.setRange(j(v,i.AABBBounds,!0)),l.push(i);continue}}!a&&!c&&l.push(i)}return i.isFunction(this.onAfterLabelOverlap)&&this.onAfterLabelOverlap(g),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){var s,a,n,r,l;const o=null!==(s=this.attribute.animation)&&void 0!==s?s:{},d=!1===this._enableAnimation||!1===o,h=null!==(a=o.mode)&&void 0!==a?a:rt,u=null!==(n=o.duration)&&void 0!==n?n:lt,c=null!==(r=o.easing)&&void 0!==r?r:ot,b=null!==(l=o.delay)&&void 0!==l?l:0,p=new Map,v=this._graphicToText||new Map,g=[];t.forEach(((t,s)=>{var a,n,r,l,_,y,m,x,f;const A=(null===(a=t.attribute)||void 0===a?void 0:a.labelLinePath)?e.createPath({visible:null===(r=null===(n=t.attribute)||void 0===n?void 0:n.visible)||void 0===r||r,stroke:null!==(y=null===(_=null===(l=t.attribute)||void 0===l?void 0:l.line)||void 0===_?void 0:_.stroke)&&void 0!==y?y:null===(m=t.attribute)||void 0===m?void 0:m.fill,lineWidth:1,path:null===(x=t.attribute)||void 0===x?void 0:x.labelLinePath}):void 0,S=this._idToGraphic.get(t.attribute.id),E=(null==v?void 0:v.get(S))?"update":"enter";if("enter"===E)if(g.push(t),p.set(S,A?{text:t,labelLine:A}:{text:t}),!d&&S){const{from:e,to:i}=nt(t.attribute,"fadeIn");this.add(t),A&&this.add(A),S.onAnimateBind=()=>{t.setAttributes(e);const a=this._afterRelatedGraphicAttributeUpdate(t,g,s,S,{mode:h,duration:u,easing:c,to:i,delay:b});S.on("afterAttributeUpdate",a)}}else this.add(t),A&&this.add(A);if("update"===E){const s=v.get(S);if(v.delete(S),p.set(S,s),d)s.text.setAttributes(t.attribute),(null==s?void 0:s.labelLine)&&s.labelLine.setAttributes({path:null===(f=t.attribute)||void 0===f?void 0:f.labelLinePath});else{const a=s.text;a.animate().to(t.attribute,u,c),!1!==o.increaseEffect&&a.attribute.text!==t.attribute.text&&i.isValidNumber(Number(a.attribute.text)*Number(t.attribute.text))&&a.animate().play(new e.IncreaseCount({text:a.attribute.text},{text:t.attribute.text},u,c))}}})),v.forEach((t=>{var e;d?(this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)):null===(e=t.text)||void 0===e||e.animate().to(nt(t.text.attribute,"fadeOut").to,u,c).onEnd((()=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)}))})),this._graphicToText=p}_afterRelatedGraphicAttributeUpdate(t,i,s,a,{mode:n,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 p=()=>{a&&(a.onAnimateBind=void 0,a.removeEventListener("afterAttributeUpdate",h))};switch(n){case"after":b.animationState.end&&t.animate({onEnd:p}).wait(d).to(o,r,l);break;case"after-all":s===i.length-1&&b.animationState.end&&i.forEach((t=>{t.animate({onEnd:p}).wait(d).to(o,r,l)}));break;default:b.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(d).to(o,r,l)}};return h}_smartInvert(t){const e=this.attribute.smartInvert||{},{textType:i,contrastRatiosThreshold:s,alternativeColors:a}=e;for(let e=0;e<t.length;e++){const n=t[e];if(!n)continue;const r=this._idToGraphic.get(n.attribute.id);let l=K(n.AABBBounds,null==r?void 0:r.AABBBounds);if("arc"===this.attribute.type&&(l="inside"===this.attribute.position),n.attribute.stroke&&n.attribute.lineWidth>0)n.setAttributes({fill:h(n.attribute.fill,n.attribute.stroke,i,s,a)});else if(l){const t=r.attribute.fill,e=n.attribute.fill;n.setAttributes({fill:h(e,t,i,s,a)})}else if(n.attribute.lineWidth>0){const t=n.attribute.stroke,e=n.attribute.fill;n.setAttributes({stroke:r.attribute.fill,fill:h(e,t,i,s,a)})}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class ht extends dt{constructor(t){super(i.merge({},ht.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e,i="top",s=0){if(!t)return;const{x1:a,y1:n,x2:r,y2:l}=t,o=Math.abs(r-a),d=Math.abs(l-n),h=(e.x1+e.x2)/2,u=(e.y1+e.y2)/2;let c=0,b=0,p=0,v=0;e&&(p=Math.abs(e.x1-e.x2)/2,v=Math.abs(e.y1-e.y2)/2);const g={"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(g[i]*(Math.PI/180)),b=Math.cos(g[i]*(Math.PI/180));break;case"center":c=0,b=0}return{x:h+c*(s+p)+Math.sign(c)*(o/2),y:u+b*(s+v)+Math.sign(b)*(d/2)}}}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 dt{constructor(t){super(i.merge({},ut.defaultAttributes,t))}labeling(t,e,i="top",s=0){if(!t||!e)return;const{x1:a,y1:n,x2:r,y2:l}=t,o=Math.abs(r-a),d=Math.abs(l-n),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,p=0,v=0;switch(i){case"top":case"inside-top":v=-.5;break;case"bottom":case"inside-bottom":v=.5;break;case"left":case"inside-left":p=-.5;break;case"right":case"inside-right":p=.5}c+=p*h,b+=v*u;let g=0,_=0;const y=i.includes("inside");i.includes("top")?_=y?1:-1:i.includes("bottom")?_=y?-1:1:i.includes("left")?g=y?1:-1:i.includes("right")&&(g=y?-1:1);return{x:c+g*s+g*o/2,y:b+_*s+_*d/2}}}ut.tag="rect-label",ut.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ct extends dt{constructor(t){super(i.merge({},ct.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,a=(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)||[e],n="start"===s?0:a.length-1;return{x1:a[n].x,x2:a[n].x,y1:a[n].y,y2:a[n].y}}labeling(t,e,i="end",s=0){if(!t||!e)return;const{x1:a,x2:n}=t,r=Math.abs(n-a),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 bt(t,e,i,s){const a=(n={radius:i,angle:s}).radius?{x:Math.cos(n.angle)*n.radius,y:Math.sin(n.angle)*n.radius}:{x:0,y:0};var n;return{x:t+a.x,y:e+a.y}}function pt(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 vt(t){return 3===t||4===t}function gt(t,e){const{x1:i,y1:s,x2:a,y2:n}=t,{x1:r,y1:l,x2:o,y2:d}=e;return!(i<=r&&a<=r||i>=o&&a>=o||s<=l&&n<=l||s>=d&&n>=d)}ct.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"end",offset:6,pickable:!1};class _t{constructor(t,e,i,s,a,n){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=a,this.middleAngle=n,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 yt extends dt{constructor(t){super(i.merge({},yt.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}}layoutArcLabels(t,e,i,s,a){this._arcLeft.clear(),this._arcRight.clear();const{width:n,height:r}=e;i.forEach(((t,i)=>{var l,o;const d=t.attribute,h=this.computeLayoutOuterRadius(d.outerRadius,n,r),u=this.computeRadius(h,n,r),c={x:null!==(l=null==d?void 0:d.x)&&void 0!==l?l:0,y:null!==(o=null==d?void 0:d.y)&&void 0!==o?o:0},b=s[i],p=a[i],v=(d.startAngle+d.endAngle)/2,g=d.endAngle-d.startAngle,_=pt(d.endAngle-g/2),y=bt(c.x,c.y,d.outerRadius,v),m=bt(c.x,c.y,u+e.line.line1MinLength,v),x=new _t(b,y,m,_,g,v);var f;x.pointA=bt(c.x,c.y,this.computeDatumRadius(2*c.x,2*c.y,d.outerRadius),x.middleAngle),x.labelSize={width:p.x2-p.x1,height:p.y2-p.y1},1===(f=x.quadrant)||2===f?this._arcRight.set(x.refDatum,x):vt(x.quadrant)&&this._arcLeft.set(x.refDatum,x)}));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){var a,n,r,l;const o={x:null!==(n=null===(a=s[0].attribute)||void 0===a?void 0:a.x)&&void 0!==n?n:0,y:null!==(l=null===(r=s[0].attribute)||void 0===r?void 0:r.y)&&void 0!==l?l:0},d=this.computeLayoutOuterRadius(s[0].attribute.innerRadius,e.width,e.height),h=this.computeLayoutOuterRadius(s[0].attribute.outerRadius,e.width,e.height),u=e,c=u.spaceWidth;return t.forEach((t=>{const{labelSize:s,radian:a}=t,n=this.computeRadius(d,e.width,e.height,1),r=this.computeRadius(h,e.width,e.height,1),l=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(r,s.height);let b;if(a<l)b=0;else{let t;t=a>=Math.PI?n:Math.max(n,s.height/2/Math.tan(a/2)),b=r-t-c}!0!==(null==u?void 0:u.rotate)&&(b=r-c);const p=this._getFormatLabelText(t.refDatum,b);t.labelText=p;const v=Math.min(b,t.labelSize.width),g=this._computeAlign(t,e),_=r-c-("left"===g?v:"right"===g?0:v/2);t.labelPosition=bt(o.x,o.y,_,t.middleAngle),t.labelLimit=v,i.isGreater(v,0)||(t.labelVisible=!1),t.angle=t.middleAngle})),t}_layoutOutsideLabels(t,e,s){var a,n,r,l,o;const d=null!==(n=null===(a=s[0].attribute)||void 0===a?void 0:a.x)&&void 0!==n?n: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=vt(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:a}=i;i.labelLimit=a.width,i.pointB=vt(i.quadrant)?{x:t.x+a.width/2+u+b,y:t.y}:{x:t.x-a.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:a,maxY:n}=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-a),Math.abs(n-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 p=2*d;return t.forEach((t=>{t.labelVisible&&(i.isLess(t.pointB.x,u+b)||i.isGreater(t.pointB.x,p-u-b))&&(t.labelVisible=!1),t.angle=0,t.labelLinePath=`M${Math.round(t.pointA.x)},${Math.round(t.pointA.y)} L${Math.round(t.pointB.x)},${Math.round(t.pointB.y)} L${Math.round(t.pointC.x)},${Math.round(t.pointC.y)}`})),t}_computeX(t,e,s){var a,n,r,l,o;const d=null!==(n=null===(a=s[0].attribute)||void 0===a?void 0:a.x)&&void 0!==n?n:0,h=2*d,u=(l=null===(r=s[0].attribute)||void 0===r?void 0:r.y,this.computeLayoutOuterRadius(s[0].attribute.outerRadius,e.width,e.height)),c=e.line.line1MinLength,b=e.line.line2MinLength,p=null===(o=e.layout)||void 0===o?void 0:o.align,v=e.spaceWidth;this._computeAlign(t,e);const{labelPosition:g,quadrant:_,pointB:y}=t;i.isValidNumber(y.x*y.y)||(t.pointC={x:NaN,y:NaN},g.x=NaN,t.labelLimit=0);const m=this.computeRadius(u,e.width,e.height),x=vt(_)?-1:1;let f=0;let A=(x>0?h-y.x:y.x)-b-v;"labelLine"===p&&(f=(m+c+b)*x+d,A=(x>0?h-f:f)-v);const S=this._getFormatLabelText(t.refDatum,A);t.labelText=S;let E=Math.min(A,t.labelSize.width);switch(p){case"labelLine":break;case"edge":f=x>0?h-E-v:E+v;break;default:f=y.x+x*b}if(E=Math.max(this._ellipsisWidth,E),t.pointC={x:f,y:g.y},"edge"===p){const t=0;g.x=x>0?h+t:t}else{const e=0;g.x=f+e+x*(v+.5*t.labelSize.width)}t.labelLimit=E}_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,a,n,r,l,o;const d=e,h=null!==(a=null===(s=d.textStyle)||void 0===s?void 0:s.textAlign)&&void 0!==a?a:null===(n=d.textStyle)||void 0===n?void 0:n.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?vt(t.quadrant)?"left":"right":vt(t.quadrant)?"right":"left":h:i.isNil(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){return t.text}_adjustY(t,e,s,a){var n,r,l,o;r=null===(n=a[0].attribute)||void 0===n?void 0:n.x;const d=2*(null!==(o=null===(l=a[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 a=t.length;if(a<=0)return;for(let n=0;n<a;n++){const{y1:r}=t[n].getLabelBounds();if(e=r-s,i.isLess(e,0)){const i=this._shiftY(t,n,a-1,-e);this._shiftY(t,i,0,e/2)}const{y2:l}=t[n].getLabelBounds();s=l}const{y1:n}=t[0].getLabelBounds();e=n-0,i.isLess(e,0)&&this._shiftY(t,0,a-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 n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.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=n[o].arc;this._computeYRange(e,s,a),e.labelVisible=!0;const u=e.labelPosition.y,{lastIndex:c,nextIndex:b}=this._findNeighborIndex(t,n[o]),p=t[c],v=t[b];if(-1===c&&-1!==b){const i=v.labelPosition.y;u>i?e.labelPosition.y=i-v.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,v,b)}else 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,p,e,n[o].originIndex)}else if(-1!==c&&-1!==b){const i=p.labelPosition.y,s=v.labelPosition.y;u>s?(e.labelPosition.y=s-v.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[o].originIndex)):u<i?(e.labelPosition.y=i+p.labelSize.height/2+e.labelSize.height/2,this._twoWayShift(t,e,v,b)):(this._twoWayShift(t,p,e,n[o].originIndex),this._twoWayShift(t,e,v,b))}const g=Math.min(r,n[o].originIndex),_=Math.max(l,n[o].originIndex);let y;if(y=t[_].getLabelBounds().y2-d,i.isGreater(y,0)&&this._shiftY(t,_,0,-y),y=t[g].getLabelBounds().y1-0,i.isLess(y,0)&&this._shiftY(t,g,t.length-1,-y),y=t[_].getLabelBounds().y2-d,i.isGreater(y,0)){e.labelVisible=!1,this._restoreY(t);break}h.tangentConstraint&&!this._checkYRange(t)?(e.labelVisible=!1,this._restoreY(t)):(r=g,l=_)}}}_shiftY(t,e,i,s){const a=e<i?1:-1;let n=e;for(;-1!==n;){t[n].labelPosition.y+=s;const e=this._findNextVisibleIndex(t,n,i,a);if(e>=0&&e<t.length){const{y1:i,y2:s}=t[n].getLabelBounds(),{y1:r,y2:l}=t[e].getLabelBounds();if(a>0&&s<r||a<0&&i>l)return n}n=e}return i}_findNextVisibleIndex(t,e,i,s){const a=(i-e)*s;for(let i=1;i<=a;i++){const a=e+i*s;if(t[a].labelVisible)return a}return-1}_computePointB(t,e,s,a){var n,r,l,o;const d=s,h=this.computeLayoutOuterRadius(a[0].attribute.outerRadius,s.width,s.height),u=d.line.line1MinLength;if("none"===d.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const d={x:null!==(r=null===(n=a[0].attribute)||void 0===n?void 0:n.x)&&void 0!==r?r:0,y:null!==(o=null===(l=a[0].attribute)||void 0===l?void 0:l.y)&&void 0!==o?o:0},c=this.computeRadius(h,s.width,s.height),{labelPosition:b,quadrant:p}=t,v=e-Math.max(c+u,a[0].attribute.outerRadius),g=Math.sqrt(e**2-Math.abs(d.y-b.y)**2)-v;i.isValidNumber(g)?t.pointB={x:d.x+g*(vt(p)?-1:1),y:b.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){var a,n,r,l;const o={width:2*(null!==(n=null===(a=s[0].attribute)||void 0===a?void 0:a.x)&&void 0!==n?n:0),height:2*(null!==(l=null===(r=s[0].attribute)||void 0===r?void 0:r.y)&&void 0!==l?l:0)},d=this.computeLayoutOuterRadius(s[0].attribute.outerRadius,e.width,e.height),h=e.line.line1MinLength,{width:u,height:c}=o,b=this.computeRadius(d,e.width,e.height),p=this._computeLayoutRadius(c/2,e,s),v=Math.abs(t.center.x-u/2),g=t.center.y-c/2;let _,y,m;if(i.isNumberClose(u/2,v))_=0,y=1,m=-g;else if(i.isNumberClose(c/2,g))_=1,y=0,m=-v;else{const t=-1/(g/v);_=t,y=-1,m=g-t*v}const x=function(t,e,i,s,a,n){if(0===t&&0===e||n<=0)return[];if(0===t){const t=-i/e,r=n**2-(t-a)**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=n**2-(e-s)**2;return r<0?[]:0===r?[{x:e,y:a}]:[{x:e,y:Math.sqrt(r)+a},{x:e,y:-Math.sqrt(r)+a}]}const r=(e/t)**2+1,l=2*((i/t+s)*(e/t)-a),o=l**2-4*r*((i/t+s)**2+a**2-n**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}]}(_,y,m,h+b-p,0,p);if(x.length<2)return;let f,A;x[0].x>x[1].x&&x.reverse(),x[0].x<0?i.isNumberClose(x[0].y,x[1].y)?Math.abs(t.middleAngle)<Math.PI/2?(f=0,A=x[1].y+c/2):(f=x[1].y+c/2,A=c):x[0].y<x[1].y?(f=0,A=x[1].y+c/2):(f=x[1].y+c/2,A=o.height):(f=Math.min(x[0].y,x[1].y)+c/2,A=Math.max(x[0].y,x[1].y)+c/2),t.labelYRange=[f,A]}_computeLayoutRadius(t,e,i){const s=e,a=s.layoutArcGap,n=s.line.line1MinLength,r=this.computeLayoutOuterRadius(i[0].attribute.outerRadius,e.width,e.height),l=this.computeRadius(r,e.width,e.height)+n,o=l-a;return Math.max((o**2+t**2)/(2*o),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,a=-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){a=e;break}return{lastIndex:s,nextIndex:a}}_twoWayShift(t,e,s,a){const n=s.getLabelBounds().y1-e.getLabelBounds().y2;if(i.isLess(n,0)){const e=this._shiftY(t,a,t.length-1,-n);this._shiftY(t,e,0,n/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();gt(e,s)?t[i].labelVisible=!1:e=s}}computeRadius(t,e,s,a){return this.computeLayoutRadius(e||0,s||0)*t*(i.isNil(a)?1:a)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}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}}yt.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}};const mt={rect:ut,symbol:ht,arc:yt};class xt extends n{constructor(t){super(i.merge({},xt.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:a=0}=e||{};if(!s||!a||!i.isValidNumber(a*s))return;this._componentMap||(this._componentMap=new Map);const n=Z(s,a),r=n.bitmap(),l=new Map,o=this._componentMap;for(let e=0;e<t.length;e++){const i=t[e];if(mt[i.type]){const{baseMarkGroupName:t}=i;let e=this._componentMap.get(t);e?(e.setBitmapTool(n),e.setBitmap(r),e.setAttributes(i),l.set(t,e)):(e=new mt[i.type](i),e.setBitmap(r),e.setBitmapTool(n),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()}))}}function ft(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 At(t,e,s,a){let n="";if(!t||0===e.length)return n;const r=e[0],l=i.PointService.distancePP(t,r),o=s?0:1;return a?n+=`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?n=`M${t.x},${t.y}`:n+=`A${l},${l},0,0,${o},${t.x},${t.y}`})),n}function St(t,e,s){const{type:a,closed:n}=s,r=e.slice(0).reverse();let l="",o="";if("line"===a&&s.smoothLink&&s.center){const e=t[0],a=r[0],d=s.center;l=ft(t,!!n),o=ft(r,!!n);const h=i.PointService.distancePP(a,d),u=i.PointService.distancePP(e,d);l+=`A${h},${h},0,0,1,${a.x},${a.y}L${a.x},${a.y}`,o+=`A${u},${u},0,0,0,${e.x},${e.y}`}else if("circle"===a){const{center:e}=s;l=At(e,t,!1,!!n),o=At(e,r,!0,!!n)}else"line"!==a&&"polygon"!==a||(l=ft(t,!!n),o=ft(r,!!n));return n?l+=o:(o="L"+o.substring(1),l+=o,l+="Z"),l}xt.defaultAttributes={pickable:!1};class Et extends n{constructor(t){super(i.merge({},Et.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:s,style:a,closed:n,alternateColor:r,depth:l=0}=this.attribute;if(!i.isEmpty(s)&&(s.forEach(((s,r)=>{const{id:o,points:d}=s;let h="";if("line"===t||"polygon"===t)h=ft(d,!!n);else if("circle"===t){const{center:t}=this.attribute;h=At(t,d,!1,!!n)}const u=e.createPath({path:h,z:l,...i.isFunction(a)?i.merge({},Et.defaultAttributes.style,a(s,r)):a});u.name=`${this.name}-line`,u.id=this._getNodeId(`path-${o}`),this.add(u)})),l&&"line"===t&&s.forEach(((t,s)=>{const{id:r,points:o}=t,d=[];d.push(o[0]);const h=o[1].x-o[0].x,u=o[1].y-o[0].y,c=Math.sqrt(h*h+u*u),b=l/c;d.push({x:o[0].x+h*b,y:o[0].y+u*b});const p=ft(d,!!n),v=i.abs(d[0].x-d[1].x),g=i.abs(d[0].y-d[1].y),_=e.createPath({path:p,z:0,alpha:v>g?(o[1].x-o[0].x>0?-1:1)*i.pi/2:0,beta:v<g?-i.pi/2:0,anchor3d:v>g?[d[0].x,0]:[0,d[0].y],...i.isFunction(a)?i.merge({},Et.defaultAttributes.style,a(t,s)):a});_.name=`${this.name}-line`,_.id=this._getNodeId(`path-${r}`),this.add(_)})),s.length>1&&r)){const t=i.isArray(r)?r:[r,"transparent"],a=e=>t[e%t.length];for(let t=0;t<s.length-1;t++){const[i,n]=[s[t].points,s[t+1].points],r=St(i,n,this.attribute),l=e.createPath({path:r,fill:a(t)});l.name=`${this.name}-region`,l.id=this._getNodeId(`region-${t}`),this.add(l)}}}_getNodeId(t){return`${this.id}-${t}`}}Et.defaultAttributes={style:{lineWidth:1,stroke:"#416180"},zIndex:0};class Lt extends n{constructor(t){super(i.merge({},Lt.defaultAttributes,t)),this.name="segment"}computeLineAngle(){const{points:t}=this.attribute,e=t[0],i=t[1],s=t[t.length-2],a=t[t.length-1],n=[e.x-i.x,e.y-i.y],r=Math.atan2(n[1],n[0]),l=[a.x-s.x,a.y-s.y],o=Math.atan2(l[1],l[0]);this._startAngle=r,this._endAngle=o}render(){this.removeAllChild();const{points:t,startSymbol:s,endSymbol:a,lineStyle:n,state:r,visible:l=!0}=this.attribute;if(!l)return;t.length>1&&this.computeLineAngle();const o=this.renderSymbol(s,"start"),d=this.renderSymbol(a,"end");this.startSymbol=o,this.endSymbol=d;let h=t;if(null==s?void 0:s.visible){const e=(null==s?void 0:s.clip)?(null==s?void 0:s.size)||10:0;h=[{x:t[0].x-e/2*(Math.cos(this._startAngle)||0),y:t[0].y-e/2*(Math.sin(this._startAngle)||0)},...h.slice(1)]}if(null==a?void 0:a.visible){const e=(null==a?void 0:a.clip)?(null==a?void 0:a.size)||10:0,i={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)};h=[...h.slice(0,h.length-1),i]}const u=e.createLine({points:h,fill:!1,...n});u.name="line",u.id=this._getNodeId("line"),i.isEmpty(null==r?void 0:r.line)||(u.states=r.line),this.line=u,this.add(u)}renderSymbol(t,s){const{autoRotate:a=!0}=t;let n;if(null==t?void 0:t.visible){const r=this._startAngle,l=this._endAngle,{points:o,state:d}=this.attribute,h=o[0],u=o[o.length-1],{refX:c=0,refY:b=0,refAngle:p=0,style:v,symbolType:g,size:_=12}=t;let y,m;"start"===s?(y={x:h.x+(r?c*Math.cos(r)+b*Math.cos(r-Math.PI/2):0),y:h.y+(r?c*Math.sin(r)+b*Math.sin(r-Math.PI/2):0)},m=r+Math.PI/2):(y={x:u.x+(l?c*Math.cos(l)+b*Math.cos(l-Math.PI/2):0),y:u.y+(l?c*Math.sin(l)+b*Math.sin(l-Math.PI/2):0)},m=l+Math.PI/2),n=e.createSymbol({...y,symbolType:g,size:_,angle:a?m+p:0,strokeBoundsBuffer:0,...v}),n.name=`${s}-symbol`,n.id=this._getNodeId(`${s}-symbol`),i.isEmpty(null==d?void 0:d.symbol)||(n.states=d.symbol),this.add(n)}return n}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var kt,Bt;Lt.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,(kt=t.AXIS_ELEMENT_NAME||(t.AXIS_ELEMENT_NAME={})).innerView="inner-view",kt.axisContainer="axis-container",kt.labelContainer="axis-label-container",kt.tickContainer="axis-tick-container",kt.tick="axis-tick",kt.subTick="axis-sub-tick",kt.label="axis-label",kt.title="axis-title",kt.gridContainer="axis-grid-container",kt.grid="axis-grid",kt.gridRegion="axis-grid-region",kt.line="axis-line",kt.background="axis-background",kt.axisLabelBackground="axis-label-background",t.AxisStateValue=void 0,(Bt=t.AxisStateValue||(t.AxisStateValue={})).selected="selected",Bt.selectedReverse="selected_reverse",Bt.hover="hover",Bt.hoverReverse="hover_reverse";const Mt={[t.AxisStateValue.selectedReverse]:{},[t.AxisStateValue.selected]:{},[t.AxisStateValue.hover]:{},[t.AxisStateValue.hoverReverse]:{}},wt={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}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class Tt extends n{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(x.hover,!0),l(this.axisContainer,(t=>{t!==e&&t.name&&!i.isEmpty(t.states)&&t.addState(x.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(l(this.axisContainer,(t=>{t.name&&!i.isEmpty(t.states)&&(t.removeState(x.hoverReverse),t.removeState(x.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(x.selected))return this._lastSelect=null,void l(this.axisContainer,(t=>{t.name&&!i.isEmpty(t.states)&&(t.removeState(x.selectedReverse),t.removeState(x.selected))}));e.name&&!i.isEmpty(e.states)&&(e.addState(x.selected,!0),l(this.axisContainer,(t=>{t!==e&&t.name&&!i.isEmpty(t.states)&&t.addState(x.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 a=e.createGroup({x:this.attribute.x,y:this.attribute.y});return this.add(a),this._renderInner(a),this.removeChild(a),this.attribute=s,a.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:a,tick:n,line:r,grid:l,items:o}=this.attribute,d=e.createGroup({x:0,y:0,zIndex:1});if(d.name=t.AXIS_ELEMENT_NAME.axisContainer,d.id=this._getNodeId("container"),d.setMode(this.mode),this.axisContainer=d,i.add(d),(null==r?void 0:r.visible)&&this.renderLine(d),o&&o.length){if(this.data=this._transformItems(o[0]),(null==n?void 0:n.visible)&&this.renderTicks(d),null==a?void 0:a.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,d.add(i),o.forEach(((t,e)=>{const s=this.renderLabels(i,t,e),a=s.getChildren();this.beforeLabelsOverlap(a,t,s,e,o.length),this.handleLabelsOverlap(a,t,s,e,o.length),this.afterLabelsOverlap(a,t,s,e,o.length)}))}(null==l?void 0:l.visible)&&this.renderGrid(i)}(null==s?void 0:s.visible)&&this.renderTitle(d)}renderTicks(s){const a=this.getTickLineItems(),n=e.createGroup({x:0,y:0,pickable:!1});n.name=t.AXIS_ELEMENT_NAME.tickContainer,n.id=this._getNodeId("tick-container"),s.add(n),a.forEach(((s,r)=>{var l;const o=e.createLine({...this._getTickLineAttribute("tick",s,r,a)});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=f;else{const t=this.data[r],e=i.merge({},f,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}n.add(o)})),this.tickLineItems=a;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({...this._getTickLineAttribute("subTick",s,l,a)});if(o.name=t.AXIS_ELEMENT_NAME.subTick,o.id=this._getNodeId(`${l}`),i.isEmpty(r.state))o.states=f;else{const t=i.merge({},f,r.state);Object.keys(t).forEach((e=>{i.isFunction(t[e])&&(t[e]=t[e](s.value,l,s,a))})),o.states=t}n.add(o)})),this.subTickLineItems=s}}renderLabels(s,a,n){const{dataFilter:r}=this.attribute.label;r&&i.isFunction(r)&&(a=r(a,n));const l=this._transformItems(a),o=e.createGroup({x:0,y:0,pickable:!1});o.name=`${t.AXIS_ELEMENT_NAME.labelContainer}-layer-${n}`,o.id=this._getNodeId(`label-container-layer-${n}`),s.add(o);let d=0,h=0,u="center",c="middle";return l.forEach(((s,a)=>{var r,b;const p=this._getLabelAttribute(s,a,l,n),v=e.createText(p);if(v.name=t.AXIS_ELEMENT_NAME.label,v.id=this._getNodeId(`layer${n}-label-${s.id}`),i.isEmpty(null===(r=this.attribute.label)||void 0===r?void 0:r.state))v.states=f;else{const t=i.merge({},f,this.attribute.label.state);Object.keys(t).forEach((e=>{i.isFunction(t[e])&&(t[e]=t[e](s,a,l,n))})),v.states=t}o.add(v);const g=null!==(b=p.angle)&&void 0!==b?b:0;d=Math.max(d,v.AABBBounds.width()),h=Math.max(h,v.AABBBounds.height()),g&&(d=Math.abs(d*Math.cos(g)),h=Math.abs(h*Math.sin(g))),u=p.textAlign,c=p.textBaseline})),this.axisLabelLayerSize[n]={width:d,height:h,textAlign:u,textBaseline:c},o}renderTitle(e){const i=this.getTitleAttribute(),s=new E({...i});s.name=t.AXIS_ELEMENT_NAME.title,s.id=this._getNodeId("title"),e.add(s)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}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:a,inside:n=!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(!a){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),l=i}const d=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const a=this.getVerticalVector(r,n,e);let o=0,h=0;i.abs(a[0])>i.abs(a[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:a=2}=t,n=this.tickLineItems,r=n.length;if(r>=2)for(let t=0;t<r-1;t++){const r=n[t],l=n[t+1];for(let t=0;t<i;t++){const n=(t+1)/(i+1),o=(1-n)*r.value+n*l.value,d=this.getTickCoord(o),h=this.getVerticalCoord(d,a,s);e.push({start:d,end:h,value:o,id:`sub-tick-${o}`})}}return e}_getTickLineAttribute(t,e,s,a){let n=i.get(this.attribute,`${t}.style`);const r=this.data[s];n=i.isFunction(n)?i.merge({},i.get(wt,`${t}.style`),"tick"===t?n(r.rawValue,s,r,this.data):n(e.value,s,e,a)):n;const{start:l,end:o,anchor:d,alpha:h,beta:u}=e;return{points:[l,o],anchor:d,alpha:h,beta:u,...n}}_getLabelAttribute(t,e,s,a){var n,r,l,o,d,h;const{space:u=4,inside:c=!1,formatMethod:b,...p}=this.attribute.label;let v=u,g=0;(null===(n=this.attribute.tick)||void 0===n?void 0:n.visible)&&(null===(r=this.attribute.tick)||void 0===r?void 0:r.inside)===c&&(g=(null===(l=this.attribute.tick)||void 0===l?void 0:l.length)||4),(null===(o=this.attribute.subTick)||void 0===o?void 0:o.visible)&&(null===(d=this.attribute.subTick)||void 0===d?void 0:d.inside)===c&&(g=Math.max(g,(null===(h=this.attribute.subTick)||void 0===h?void 0:h.length)||2)),v+=g;const _=this.getRelativeVector(t.point);a>0&&(0===_[1]?v+=(this.axisLabelLayerSize[a-1].height+i.get(this.attribute,"label.space",4))*a:v+=(this.axisLabelLayerSize[a-1].width+i.get(this.attribute,"label.space",4))*a);const y=this.getVerticalCoord(t.point,v,c),m=this.getVerticalVector(v,c,y),x=b?b(`${t.label}`,t,e,s,a):t.label;let{style:f}=p;return f=i.isFunction(f)?i.merge({},wt.label.style,f(t,e,s,a)):f,f=i.merge({textAlign:this.getTextAlign(m),textBaseline:this.getTextBaseline(m,c)},f),i.isFunction(f.text)&&(f.text=f.text({label:t.label,value:t.rawValue,index:t.index,layer:a})),{...y,text:x,lineHeight:null==f?void 0:f.fontSize,...f}}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push({...t,point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label})})),e}_renderGridByType(e,i){const s=this.getGridAttribute(e),a=new Et({pickable:!1,...s,zIndex:0});a.name="subGrid"===e?`${t.AXIS_ELEMENT_NAME.grid}-sub`:`${t.AXIS_ELEMENT_NAME.grid}`,a.id=this._getNodeId(e),i.add(a)}}const Ct={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&&Pt(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Pt(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function It(t,e){for(let i,s=1,a=t.length,n=t[0].AABBBounds;s<a;n=i,++s)if(Pt(n,i=t[s].AABBBounds,e))return!0}function Ht(t){const e=t.AABBBounds;return e.width()>1&&e.height()>1}function zt(t){for(let a=1;a<t.length;a++)if(e=t[a-1],s=t[a],i.isRotateAABBIntersect(e.rotatedBounds,s.rotatedBounds,!0))return!0;var e,s;return!1}function Vt(t,e){"bottom"!==t&&"top"!==t||Nt(t,e),"left"!==t&&"right"!==t||Rt(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,a=e.centerY,n=e.angle,r=t.attribute.x,l=t.attribute.y,{x:(s-r)*Math.cos(n)+(a-l)*Math.sin(n)+r,y:(s-r)*Math.sin(n)+(l-a)*Math.cos(n)+l});var s,a,n,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 Rt(t,e){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"]),e.forEach(((t,e)=>{let a=t.attribute.angle||0;if(a<0)for(;a<0;)a+=2*Math.PI;if(a>0)for(;a>=2*Math.PI;)a-=2*Math.PI;const n=a/(.5*Math.PI);let r;r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,t.setAttributes({textAlign:i[r],textBaseline:s[r],angle:a})}))}function Nt(t,e){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"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const a=e/(.5*Math.PI);let n;n=a===Math.floor(a)?2*Math.floor(a):2*Math.floor(a)+1,t.setAttributes({textAlign:i[n],textBaseline:s[n],angle:e})}))}class Dt extends Tt{constructor(t,e){super(i.merge({},Dt.defaultAttributes,t),e),"3d"===e&&this.setMode(e)}_renderInner(s){var a;super._renderInner(s);const{panel:n}=this.attribute;if(n&&n.visible){const s=this.axisContainer,r=s.AABBBounds,l=e.createRect({x:r.x1,y:r.y1,width:r.width(),height:r.height(),...n.style});l.name=t.AXIS_ELEMENT_NAME.background,l.id=this._getNodeId("background"),l.states=i.merge({},Mt,null!==(a=n.state)&&void 0!==a?a:{}),s.insertBefore(l,s.firstChild)}}renderLine(e){const{start:s,end:a,line:n}=this.attribute,{startSymbol:r,endSymbol:l,style:o,breakRange:d,breakShape:h,breakShapeStyle:u,state:c,...b}=n,p={points:[s,a],startSymbol:r,endSymbol:l,lineStyle:o,...b};i.isEmpty(c)||(p.state={line:i.merge({},Mt,c),symbol:i.merge({},Mt,c)});const v=new Lt(p);v.name=t.AXIS_ELEMENT_NAME.line,v.id=this._getNodeId("line"),e.add(v)}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(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t,e=!1){const{verticalFactor:i=1}=this.attribute,s=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 v([s[1],-1*s[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,s,a,n,r,l,o;const{position:d="middle",space:h=4,textStyle:u={},autoRotate:c=!0,shape:b,background:p,state:v,..._}=this.attribute.title;let y=.5;"start"===d?y=0:"end"===d&&(y=1);const{verticalFactor:m=1}=this.attribute,x=-1*m,f=this.getTickCoord(y),A=this.getRelativeVector();let S=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);S+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===A[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?S+=i+(e-1)*t:S=0}else{if(0===A[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?S+=i+(e-1)*t:S=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{S+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,a="center"===i,n=A[1]>0;S=1===x?n?s?S:a?S/2:t:s?t:a?S/2:S:n?s?t:a?S/2:S:s?S:a?S/2:t}}let E=0;(null===(s=this.attribute.tick)||void 0===s?void 0:s.visible)&&!1===(null===(a=this.attribute.tick)||void 0===a?void 0:a.inside)&&(E=(null===(n=this.attribute.tick)||void 0===n?void 0:n.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)&&(E=Math.max(E,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const L=E+S+h,k=this.getVerticalCoord(f,L,!1),B=this.getVerticalVector(L,!1);let M,w,{angle:T}=_;if(M="start"===d?"start":"end"===d?"end":"center",i.isNil(T)&&c){T=g(A,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1===-1*t?"bottom":"top"}else M=this.getTextAlign(B),w=this.getTextBaseline(B,!1);const C={...k,..._,textStyle:{textAlign:M,textBaseline:w,...u},state:{text:i.merge({},Mt,null==v?void 0:v.text),shape:i.merge({},Mt,null==v?void 0:v.shape),panel:i.merge({},Mt,null==v?void 0:v.background)}};return C.angle=T,b&&b.visible&&(C.shape={visible:!0,...b.style},b.space&&(C.space=b.space)),p&&p.visible&&(C.panel={visible:!0,...p.style}),C}_getGridPoint(t,e){let s;if("line"===t){const{length:t}=this.attribute.grid;s=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:a,startAngle:n=_,endAngle:r=y}=this.attribute.grid;s=function(t,e,s,a,n){const r=[],l=n-a;for(let n=0;n<e;n++){const o=a+n*l/e;r.push(i.polarToCartesian(t,s,o))}return r}(t,a,i.PointService.distancePP(t,e),n,r)}return s}getGridAttribute(t){const{type:e,alignWithLabel:s=!0}=this.attribute.grid;let a=1;let n;this.data.length>=2&&(a=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((i=>{let{point:n}=i;if(!s){const t=i.value-a/2;if(this.isInValidValue(t))return;n=this.getTickCoord(t)}t.push({id:i.label,datum:i,points:this._getGridPoint(e,n)})})),r=t}else{n=i.merge({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:l=4}=this.attribute.subTick||{};if(this.data.length>=2){const i=[];this.data.forEach((t=>{let e=t.value;if(!s){const i=t.value-a/2;if(this.isInValidValue(i))return;e=i}i.push({value:e})}));for(let s=0;s<i.length-1;s++){const a=i[s],n=i[s+1];t.push({id:`sub-${s}-0`,points:this._getGridPoint(e,this.getTickCoord(a.value)),datum:{}});for(let i=0;i<l;i++){const r=(i+1)/(l+1),o=(1-r)*a.value+r*n.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(n.value)),datum:{}})}r=t}}return{...n,items:r}}getTextBaseline(t,e){let s="middle";const{verticalFactor:a=1}=this.attribute,n=(e?1:-1)*a;return i.isNumberClose(t[1],0)?s=!i.isNumberClose(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?s="top":t[1]<0&&(s="bottom"),s}beforeLabelsOverlap(t,e,i,s,a){const n=this.attribute.orient;"left"===n||"right"===n?Rt(n,t):"bottom"!==n&&"top"!==n||Nt(n,t)}handleLabelsOverlap(t,e,s,a,n){if(i.isEmpty(t))return;const{verticalLimitSize:r,label:l,orient:o}=this.attribute,d=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:u,autoRotateAngle:c,autoLimit:b,limitEllipsis:p,autoHide:v,autoHideMethod:g,autoHideSeparation:_}=l;i.isFunction(h)?h(t,e,a,this):(u&&function(t,e){if(i.isEmpty(t))return;const{orient:s,labelRotateAngle:a=[0,45,90]}=e;if(0===a.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(a&&a.length>0&&(r=a.length);n<r;){const e=a[n++];if(t.forEach((t=>{t.attribute.angle=i.degreeToRadian(e)})),Vt(s,t),!zt(t))break}}(t,{labelRotateAngle:c,orient:o}),b&&i.isValidNumber(d)&&d>0&&function(t,e){const{limitLength:s,ellipsis:a="...",orient:n}=e;!i.isEmpty(t)&&i.isValidNumber(s)&&t.forEach((t=>{if(("top"===n||"bottom"===n)&&Math.floor(t.AABBBounds.height())<=s)return;if(("left"===n||"right"===n)&&Math.floor(t.AABBBounds.width())<=s)return;let e=0===t.attribute.angle||i.isNil(t.attribute.angle)?"top"===n||"bottom"===n?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||a})}))}(t,{limitLength:d,ellipsis:p,orient:o}),v&&function(t,e){if(i.isEmpty(t))return;const s=t.filter(Ht);if(i.isEmpty(s))return;let a;a=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(s);const{method:n="parity",separation:r=0}=e,l=i.isFunction(n)?n:Ct[n]||Ct.parity;if(a.length>=3&&It(a,r)){do{a=l(a,r)}while(a.length>=3&&It(a,r));a.length<3&&!i.last(s).attribute.opacity&&(a.length>1&&i.last(a).setAttribute("opacity",0),i.last(s).setAttribute("opacity",1))}s.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:g,separation:_}))}afterLabelsOverlap(s,a,n,r,l){const{verticalLimitSize:o,orient:d}=this.attribute,h="bottom"===d||"top"===d,u=n.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,a;c=Math.max(c,i),"left"===d?(s=u.x2-c,a=u.y1):"right"===d?(s=u.x1,a=u.y1):"top"===d?(s=u.x1,a=u.y2-c):"bottom"===d&&(s=u.x1,a=u.y1);const r=e.createRect({x:s,y:a,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"),n.insertBefore(r,n.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,a){if("right"===s||"left"===s){if("left"===a){const a="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*a,textAlign:"left"})}))}else if("right"===a){const a="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*a,textAlign:"right"})}))}else if("center"===a){const a="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*a,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===a){const a="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*a,textBaseline:"top"})}))}else if("bottom"===a){const a="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*a,textBaseline:"bottom"})}))}else if("middle"===a){const a="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*a,textBaseline:"middle"})}))}}(s,t,c,d,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var s,a,n;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 p=(null==o?void 0:o.visible)?null!==(a=o.style.lineWidth)&&void 0!==a?a:1:0,v=(null==d?void 0:d.visible)?null!==(n=d.length)&&void 0!==n?n:4:0;if(null==l?void 0:l.visible){c=S(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-p-v)/e),u}}Dt.defaultAttributes=wt;class Ot extends Tt{constructor(t){super(i.merge({},Ot.defaultAttributes,t))}renderLine(s){const{startAngle:a=_,endAngle:n=y,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={...l,startAngle:a,endAngle:n,radius:u,innerRadius:c,...null==d?void 0:d.style},p=e.createCircle(b);p.name=t.AXIS_ELEMENT_NAME.line,p.id=this._getNodeId("line"),i.isEmpty(null==d?void 0:d.state)||(p.states=i.merge({},Mt,d.state)),s.add(p)}isInValidValue(t){const{startAngle:e=_,endAngle:i=y}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=_,endAngle:s=y,center:a,radius:n,inside:r=!1,innerRadius:l=0}=this.attribute,o=e+(s-e)*t;return i.polarToCartesian(a,r&&l>0?l:n,o)}getVerticalVector(t,e=!1,i){const{inside:s=!1}=this.attribute,{center:a}=this.attribute,n=[i.x-a.x,i.y-a.y];return v(n,(e?-1:1)*(s?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(n))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,s,a,n,r,l,o;const{center:d,radius:h,innerRadius:u=0}=this.attribute,{space:c=4,textStyle:b={},shape:p,background:v,state:g,..._}=this.attribute.title;let y=d,m=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)&&(m=i.get(this.attribute.label,"style.fontSize",12)+i.get(this.attribute.label,"space",4));let x=0;(null===(s=this.attribute.tick)||void 0===s?void 0:s.visible)&&!1===(null===(a=this.attribute.tick)||void 0===a?void 0:a.inside)&&(x=(null===(n=this.attribute.tick)||void 0===n?void 0:n.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)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const f=h+x+m+c;let A="middle",{position:S}=this.attribute.title;i.isNil(S)&&(S=0===u?"end":"middle"),"start"===S?(A="bottom",y={x:d.x,y:d.y-f}):"end"===S&&(A="top",y={x:d.x,y:d.y+f});const E={...y,..._,textStyle:{textBaseline:A,textAlign:"center",...b},state:{text:i.merge({},Mt,null==g?void 0:g.text),shape:i.merge({},Mt,null==g?void 0:g.shape),panel:i.merge({},Mt,null==g?void 0:g.background)}},{angle:L}=_;return E.angle=L,p&&p.visible&&(E.shape={visible:!0,...p.style},p.space&&(E.space=p.space)),v&&v.visible&&(E.panel={visible:!0,...v.style}),E}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:a=4,inside:n=!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<a;t++){const l=(t+1)/(a+1),h=(1-l)*e.value+l*(o?o.value:d?1:e.value+i),u=this.getTickCoord(h),c=this.getVerticalCoord(u,r,n);s.push({start:u,end:c,value:h})}}}return s}getGridAttribute(t){let e,s=[];const{radius:a,innerRadius:n=0,startAngle:r=_,endAngle:l=y,center:o,grid:d}=this.attribute,{alignWithLabel:h=!0}=d||{},u=a-n;let c=1;if(this.data.length>=2&&(c=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let i;i=Math.abs(l-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,i.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-c/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),s=t}else{e=i.merge({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{},n=this.data.length;if(n>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-c/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i<n;i++){const s=e[i],n=e[i+1];t.push({id:`sub-${i}-0`,points:[this.getTickCoord(s.value),this.getVerticalCoord(this.getTickCoord(s.value),u,!0)],datum:{}});for(let e=0;e<a;e++){const r=(e+1)/(a+1),l=(1-r)*s.value+r*(n?n.value:h?1:s.value+c),o=this.getTickCoord(l),d=this.getVerticalCoord(o,u,!0);t.push({id:`sub-${i}-${e+1}`,points:[o,d],datum:{}})}}Math.abs(l-r)%(2*Math.PI)==0&&t.push(t[0]),s=t}}return{...e,items:s,center:o}}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,a){}handleLabelsOverlap(t,e,i,s,a){}afterLabelsOverlap(t,e,i,s,a){}}Ot.defaultAttributes=wt;class $t 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 l(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},l(t,(t=>{var e,s,a,n,r,l;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!i.isEqual(t.attribute,o.attribute)){const n=i.cloneDeep(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:{...n,opacity:null!==(e=n.opacity)&&void 0!==e?e:1,fillOpacity:null!==(s=n.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(a=n.strokeOpacity)&&void 0!==a?a:1}},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(n=t.attribute.opacity)&&void 0!==n?n: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 a,n,r;const{node:l,attrs:o,state:d}=this._newElementAttrMap[s];"enter"===d&&(t=i.isValidNumber(null===(a=this.params.enter)||void 0===a?void 0:a.duration)?this.params.enter.duration:t,e=(null===(n=this.params.enter)||void 0===n?void 0:n.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===l.type?l.animate({interpolate:(t,e,s,a,n)=>"path"===t&&(n.path=i.interpolateString(s,a)(e),!0)}).to(o,t,e):l.animate().to(o,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 Wt 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}})}}var Ft;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(Ft||(Ft={}));class Gt extends n{constructor(t){super(i.merge({},Gt.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=Ft.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=Ft.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=Ft.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=Ft.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=Ft.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,a=this.eventPosToStagePos(t),{attPos:n,max:r}=this._layoutCache,l=(a[n]-this._activeCache.lastPos[n])/r;this._activeState&&(this._activeTag===Ft.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===Ft.startHandler?this.state.start+l>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+l,this._activeTag=Ft.endHandler):this.state.start=this.state.start+l:this._activeTag===Ft.endHandler&&(this.state.end+l<this.state.start?(this.state.end=this.state.start,this.state.start=this.state.end+l,this._activeTag=Ft.startHandler):this.state.end=this.state.end+l),this._activeCache.lastPos=a,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:a,orient:n,showDetail:r,position:l,previewData:o,previewCallbackX:d,previewCallbackY:h,previewCallbackX1:u,previewCallbackY1:c,updateStateCallback:b}=this.attribute,{width:p,height:v}=a;e&&(this.state.start=e),s&&(this.state.end=s),this._isHorizontal="top"===n||"bottom"===n,this._layoutCache.max=this._isHorizontal?p:v,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 a=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==a?void 0:a.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==a?void 0:a.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===Ft.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:a}=this.attribute,n=t[i]-a[i],r=e[i]-a[i],l=Math.min(Math.max(Math.min(n,r)/s,0),1),o=Math.min(Math.max(Math.max(n,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:a}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",{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===Ft.background&&Math.abs(this.dragMaskSize())||0,height:a,...t},"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",{x:e.x,y:i.clamp(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+a),width:s,height:this._activeState&&this._activeTag===Ft.background&&Math.abs(this.dragMaskSize())||0,...t},"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:s,...a}=t,{formatMethod:n,...r}=e,{start:l,end:o}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(o);const{position:d,width:h,height:u}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,i.merge({},a,{text:s?s(this._startValue):this._startValue,x:d.x+l*h,y:d.y+u/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${d}`),this._endText=this.maybeAddLabel(this._container,i.merge({},r,{text:n?n(this._endValue):this._endValue,x:d.x+o*h,y:d.y+u/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${d}`)):(this._startText=this.maybeAddLabel(this._container,i.merge({},a,{text:s?s(this._startValue):this._startValue,x:d.x+h/2,y:d.y+l*u,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${d}`),this._endText=this.maybeAddLabel(this._container,i.merge({},r,{text:n?n(this._endValue):this._endValue,x:d.x+h/2,y:d.y+o*u,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${d}`))}getLayoutAttrFromConfig(){var t,e,i,s;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:n,orient:r,middleHandlerStyle:l,startHandlerStyle:o,endHandlerStyle:d}=this.attribute,{width:h,height:u}=n,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,p,v;(null==l?void 0:l.visible)?this._isHorizontal?(b=h,p=u-c,v={x:a.x,y:a.y+c}):(b=h-c,p=u,v={x:a.x+("left"===r?c:0),y:a.y}):(b=h,p=u,v=a);const g=null!==(i=null==o?void 0:o.size)&&void 0!==i?i:this._isHorizontal?p:b,_=null!==(s=null==d?void 0:d.size)&&void 0!==s?s:this._isHorizontal?p:b;return(null==o?void 0:o.visible)&&(this._isHorizontal?(b-=(g+_)/2,v={x:v.x+g/2,y:v.y}):(p-=(g+_)/2,v={x:v.x,y:v.y+g})),this._layoutAttrFromConfig={position:v,width:b,height:p},this._layoutAttrFromConfig}render(){var t,e,i,s,a,n,r,l,o,d,h,u,c,b,p,v,g,_,y,m,x;this._layoutAttrFromConfig=null;const{orient:f,backgroundStyle:A,backgroundChartStyle:S,selectedBackgroundStyle:E,selectedBackgroundChartStyle:L,middleHandlerStyle:k,startHandlerStyle:B,endHandlerStyle:M,brushSelect:w}=this.attribute,{start:T,end:C}=this.state,{position:P,width:I,height:H}=this.getLayoutAttrFromConfig(),z=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=z,this._background=z.createOrUpdateChild("background",{x:P.x,y:P.y,width:I,height:H,cursor:w?"crosshair":"auto",...A},"rect"),(null===(t=null==S?void 0:S.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",z),(null===(e=null==S?void 0:S.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",z),w&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=z.createOrUpdateChild("selectedBackground",{x:P.x+T*I,y:P.y,width:(C-T)*I,height:H,cursor:w?"crosshair":"move",...E},"rect"):this._selectedBackground=z.createOrUpdateChild("selectedBackground",{x:P.x,y:P.y+T*H,width:I,height:(C-T)*H,cursor:w?"crosshair":"move",...E},"rect"),(null===(i=null==L?void 0:L.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",z),(null===(s=null==L?void 0:L.area)||void 0===s?void 0:s.visible)&&this.setSelectedPreviewAttributes("area",z),this.renderText(),this._isHorizontal?(this._startHandler=z.createOrUpdateChild("startHandler",{x:P.x+T*I,y:P.y+H/2,size:H,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"),this._endHandler=z.createOrUpdateChild("endHandler",{x:P.x+C*I,y:P.y+H/2,size:H,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"),(null==k?void 0:k.visible)&&(this._middleHandlerRect=z.createOrUpdateChild("middleHandlerRect",{x:P.x+T*I,y:P.y-((null===(r=null==k?void 0:k.background)||void 0===r?void 0:r.size)||10),width:(C-T)*I,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=z.createOrUpdateChild("middleHandlerSymbol",{x:P.x+(T+C)/2*I,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=z.createOrUpdateChild("startHandler",{x:P.x+I/2,y:P.y+T*H,size:I,angle:Math.PI/180*90,symbolType:null!==(c=null==B?void 0:B.symbolType)&&void 0!==c?c:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0,...B},"symbol"),(null==k?void 0:k.visible)&&(this._middleHandlerRect=z.createOrUpdateChild("middleHandlerRect",{x:"left"===f?P.x-((null===(b=null==k?void 0:k.background)||void 0===b?void 0:b.size)||10):P.x+I,y:P.y+T*H,width:(null===(p=null==k?void 0:k.background)||void 0===p?void 0:p.size)||10,height:(C-T)*H,...null===(v=null==k?void 0:k.background)||void 0===v?void 0:v.style},"rect"),this._middleHandlerSymbol=z.createOrUpdateChild("middleHandlerSymbol",{x:"left"===f?P.x-((null===(g=null==k?void 0:k.background)||void 0===g?void 0:g.size)||10)/2:P.x+I+((null===(_=null==k?void 0:k.background)||void 0===_?void 0:_.size)||10)/2,y:P.y+(T+C)/2*H,angle:Math.PI/180*90,symbolType:null!==(m=null===(y=null==k?void 0:k.icon)||void 0===y?void 0:y.symbolType)&&void 0!==m?m:"square",strokeBoundsBuffer:0,...null==k?void 0:k.icon},"symbol")),this._endHandler=z.createOrUpdateChild("endHandler",{x:P.x+I/2,y:P.y+C*H,size:I,angle:Math.PI/180*90,symbolType:null!==(x=null==M?void 0:M.symbolType)&&void 0!==x?x:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0,...M},"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let a,n;return this._isHorizontal?(a=[{x:e.x,y:e.y+s}],n=[{x:e.x+i,y:e.y+s}]):"left"===t?(a=[{x:e.x+i,y:e.y}],n=[{x:e.x+i,y:e.y+s}]):(a=[{x:e.x,y:e.y+s}],n=[{x:e.x,y:e.y}]),{basePointStart:a,basePointEnd:n}}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({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1,...null==i?void 0:i.line}),"area"===t&&this._previewArea.setAttributes({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:a}=this.state,{position:n,width:r,height:l}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+s*r:n.x,y:this._isHorizontal?n.y:n.y+s*l,width:this._isHorizontal?(a-s)*r:r,height:this._isHorizontal?l:(a-s)*l,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+s*r:n.x),y:-(this._isHorizontal?n.y:n.y+s*l),width:this._isHorizontal?(a-s)*r:r,height:this._isHorizontal?l:(a-s)*l,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1,...null==i?void 0:i.line}),"area"===t&&this._selectedPreviewArea.setAttributes({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 E(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:s,end:a}=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&&a===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,a;const{middleHandlerStyle:n}=this.attribute,r=null!==(e=null===(t=null==n?void 0:n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,l=null!==(a=null===(s=null==n?void 0:n.icon)||void 0===s?void 0:s.size)&&void 0!==a?a: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 Yt,Xt,qt;Gt.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,(Yt=t.IMarkLineLabelPosition||(t.IMarkLineLabelPosition={})).start="start",Yt.middle="middle",Yt.end="end",Yt.insideStartTop="insideStartTop",Yt.insideStartBottom="insideStartBottom",Yt.insideMiddleTop="insideMiddleTop",Yt.insideMiddleBottom="insideMiddleBottom",Yt.insideEndTop="insideEndTop",Yt.insideEndBottom="insideEndBottom",t.IMarkAreaLabelPosition=void 0,(Xt=t.IMarkAreaLabelPosition||(t.IMarkAreaLabelPosition={})).left="left",Xt.right="right",Xt.top="top",Xt.bottom="bottom",Xt.middle="middle",Xt.insideLeft="insideLeft",Xt.insideRight="insideRight",Xt.insideTop="insideTop",Xt.insideBottom="insideBottom",t.IMarkPointItemPosition=void 0,(qt=t.IMarkPointItemPosition||(t.IMarkPointItemPosition={})).top="top",qt.bottom="bottom",qt.middle="middle",qt.insideTop="insideTop",qt.insideBottom="insideBottom",qt.insideMiddle="insideMiddle";class Zt extends n{render(){var t,i;const s=null===(t=this.attribute.visible)||void 0===t||t;if(null!==(i=this.attribute.interactive)&&void 0!==i&&i||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),s)if(this._container)this.updateMarker();else{const t=e.createGroup({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const jt={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]}},Jt={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"}},Kt={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}},Qt={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"}},te={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"}};class ee extends Zt{constructor(t){super(i.merge({},ee.defaultAttributes,t))}setLabelPos(){var t,e,i,s,a;const{points:n,label:r}=this.attribute,l=null!==(t=null==r?void 0:r.position)&&void 0!==t?t:"end",o=this._line.getEndAngle(),d=(null==r?void 0:r.refX)*Math.cos(o)+r.refY*Math.cos(o-Math.PI/2),h=(null==r?void 0:r.refX)*Math.sin(o)+r.refY*Math.sin(o-Math.PI/2);l.includes("start")||l.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:n[0].x+d,y:n[0].y+h}):l.includes("middle")||l.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(n[0].x+n[n.length-1].x)/2+d,y:(n[0].y+n[n.length-1].y)/2+h}):null===(s=this._label)||void 0===s||s.setAttributes({x:n[n.length-1].x+d,y:n[n.length-1].y+h}),this._label.setAttributes({angle:r.autoRotate&&o+(null!==(a=null==r?void 0:r.refAngle)&&void 0!==a?a:0),textStyle:{...Jt[l],...r.textStyle}})}initMarker(t){const{points:e,startSymbol:i,endSymbol:s,label:a,lineStyle:n}=this.attribute,r=new Lt({points:e,startSymbol:i,endSymbol:s,lineStyle:n});r.name="mark-line-line",this._line=r,t.add(r);const l=new E({...a});l.name="mark-line-label",this._label=l,t.add(l),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:s,endSymbol:a,label:n,lineStyle:r}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:s,endSymbol:a,lineStyle:r}),null===(e=this._label)||void 0===e||e.setAttributes({...n}),this.setLabelPos()}}ee.defaultAttributes=jt;class ie extends Zt{constructor(t){super(i.merge({},ie.defaultAttributes,t))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,s,a,n,r;const{label:l}=this.attribute,o=null!==(t=null==l?void 0:l.position)&&void 0!==t?t:"middle";o.includes("left")||o.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes({...this.getLeftPos()}):o.includes("right")||o.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes({...this.getRightPos()}):o.includes("top")||o.includes("Top")?null===(s=this._label)||void 0===s||s.setAttributes({...this.getTopPos()}):o.includes("bottom")||o.includes("Bottom")?null===(a=this._label)||void 0===a||a.setAttributes({...this.getBottomPos()}):null===(n=this._label)||void 0===n||n.setAttributes({...this.getMiddlePos()}),null===(r=this._label)||void 0===r||r.setAttributes({textStyle:{...Qt[o],...l.textStyle}})}initMarker(t){const{points:i,label:s,areaStyle:a}=this.attribute,n=e.createPolygon({points:i,...a});n.name="mark-area-area",this._area=n,t.add(n);const r=new E({...s});r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:s,areaStyle:a}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes({points:i,...a}),null===(e=this._label)||void 0===e||e.setAttributes({...s}),this.setLabelPos()}}ie.defaultAttributes=Kt;class se extends Zt{constructor(t){super(i.merge({},se.defaultAttributes,t))}setLabelPos(){}setItemAttributes(e,i,s,a){var n;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,p=(null===(n=this._line)||void 0===n?void 0:n.getEndAngle())||0,v=l*Math.cos(p)+o*Math.cos(p-Math.PI/2),g=l*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===a?null==e||e.setAttributes({...h,textStyle:{...te[(null==i?void 0:i.position)||"end"],...null==h?void 0:h.textStyle}}):"richText"===a?null==e||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"===a&&(null==e||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)})),null==e||e.setAttributes({x:s.x+(v||0),y:s.y+(g||0),angle:r&&p+d})}getItemDx(t,e,i){var s,a;const n=null!==(a=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==a?a:(null==i?void 0:i.width)||0;return e.includes("inside")?-n:0}getItemDy(t,e,i){var s,a;const n=null!==(a=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==a?a:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-n:e.includes("middle")||e.includes("Middle")?-n/2:0}initItem(t,i){const{type:s="text",symbolStyle:a,richTextStyle:n,imageStyle:r,renderCustomCallback:l}=t;let o;return"symbol"===s?o=e.createSymbol({...i,...a}):"text"===s?o=new E({...i}):"richText"===s?o=e.createRichText({...i,...n}):"image"===s?o=e.createImage({...i,...r}):"custom"===s&&l&&(o=l()),this.setItemAttributes(o,t,i,s),o}getItemLineAttr(t,e,i){let s=[];const{type:a="type-s"}=t;return s="type-do"===a?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===a?[e,{x:i.x,y:e.y},i]:"type-op"===a?[e,{x:e.x,y:i.y},i]:[e,i],s}setItemLineAttr(t,e,i,s){var a;const{startSymbol:n,endSymbol:r,lineStyle:l}=t,o=this.getItemLineAttr(t,e,i);null===(a=this._line)||void 0===a||a.setAttributes({points:o,startSymbol:n,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,a=this._line.getEndAngle()||0;return{startPointOffsetX:s/2*Math.cos(a-Math.PI/2),startPointOffsetY:s/2*Math.sin(a-Math.PI/2),endPointOffsetX:-s/2*Math.cos(a-Math.PI/2),endPointOffsetY:-s/2*Math.sin(a-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var s;const{lineStyle:a}=t,{startPointOffsetX:n,startPointOffsetY:r,endPointOffsetX:l,endPointOffsetY:o}=this.getDecorativeLineAttr(t,e);null===(s=this._decorativeLine)||void 0===s||s.setAttributes({points:[{x:e.x+n,y:e.y+r},{x:e.x+l,y:e.y+o}],...a,visible:i})}initMarker(t){var i;const{position:s,itemLine:a,itemContent:n}=this.attribute,r={x:s.x+((null==n?void 0:n.offsetX)||0),y:s.y+((null==n?void 0:n.offsetY)||0)},l=new Lt({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(a,s,r,null==a?void 0:a.visible),this.setDecorativeLineAttr(a,r,null===(i=null==a?void 0:a.decorativeLine)||void 0===i?void 0:i.visible);const d=this.initItem(n,r);this._item=d,t.add(d)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:s}=this.attribute,{type:a="text"}=s,n={x:e.x+((null==s?void 0:s.offsetX)||0),y:e.y+((null==s?void 0:s.offsetY)||0)};this.setItemLineAttr(i,e,n,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,n,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,s,n,a)}}se.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 ae={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class ne extends n{getCurrent(){return this._current}constructor(t){super(i.merge({},ne.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 a=t.target;if("preHandler"===a.name){if(1===this._current)return;this._current-=1,1===this._current?a.addState("disable"):a.removeState("disable");const t=new e.CustomEvent("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===a.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?a.addState("disable"):a.removeState("disable");const t=new e.CustomEvent("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(s=this.stage)||void 0===s?void 0:s.eventSystem.manager,this.dispatchEvent(t)}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:a=ae,total:n,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=a.style||{},b=c.size||15,p=null!==(t=a.space)&&void 0!==t?t:8,v=a.state||{};let{preShape:g,nextShape:_}=a;g||(g=h?"triangleLeft":"triangleUp"),_||(_=h?"triangleRight":"triangleDown");const y=e.createSymbol({strokeBoundsBuffer:0,pickMode:"imprecise",...c,x:0,y:0,symbolType:g,size:b});y.states=v,y.name="preHandler",this.preHandler=y,u.add(y);const{width:m,height:x}=S(`${n}/${n}`,{textAlign:"center",textBaseline:"middle",...l}),f=i.isNumber(b)?b:b[0],A=i.isNumber(b)?b:b[1],E=e.createText({x:h?f/2+p+m/2:0,y:h?0:A/2+p+x/2,text:`${r}/${n}`,textAlign:"center",textBaseline:"middle",lineHeight:null==l?void 0:l.fontSize,...l});this.text=E,u.add(E);const L=e.createSymbol({strokeBoundsBuffer:0,pickMode:"imprecise",...c,x:h?f+2*p+m:0,y:h?0:A+2*p+x,symbolType:_,size:b});L.name="nextHandler",L.states=v,this.nextHandler=L,u.add(L),1===this._total?(y.addState("disable"),L.addState("disable")):1===this._current?y.addState("disable"):this._current===n&&L.addState("disable");const k=u.AABBBounds,B=k.width(),M=k.height();u.translateTo(0-k.x1+d[3],0-k.y1+d[0]),this.add(u),this.attribute.width=B+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}}ne.defaultAttributes={handler:ae,textStyle:{fill:"rgb(51, 51, 51)",fontSize:12}};const re=16,le=8,oe=12,de=12;var he,ue,ce;t.LegendStateValue=void 0,(he=t.LegendStateValue||(t.LegendStateValue={})).selected="selected",he.unSelected="unSelected",he.selectedHover="selectedHover",he.unSelectedHover="unSelectedHover",he.focus="focus",t.LegendEvent=void 0,(ue=t.LegendEvent||(t.LegendEvent={})).legendItemHover="legendItemHover",ue.legendItemUnHover="legendItemUnHover",ue.legendItemClick="legendItemClick",t.LEGEND_ELEMENT_NAME=void 0,(ce=t.LEGEND_ELEMENT_NAME||(t.LEGEND_ELEMENT_NAME={})).innerView="innerView",ce.title="legendTitle",ce.item="legendItem",ce.itemShape="legendItemShape",ce.itemLabel="legendItemLabel",ce.itemValue="legendItemValue",ce.focus="legendItemFocus";class be extends n{constructor(){super(...arguments),this.name="legend",this._title=null}render(){this.removeAllChild();const{interactive:s=!0,title:a,padding:n=0}=this.attribute,r=i.normalizePadding(n),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==a?void 0:a.visible)&&this._renderTitle(a),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:a,padding:n=0,background:r,minWidth:l,maxWidth:o,shape:d}=e,h={x:0,y:0,text:s,textStyle:a,padding:i.normalizePadding(n),minWidth:l,maxWidth:o};d&&d.visible&&(h.shape={visible:!0,...d.style},i.isValid(d.space)&&(h.space=d.space)),r&&r.visible&&(h.panel={visible:!0,...r.style});const u=new E(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 pe={[t.LegendStateValue.focus]:{},[t.LegendStateValue.selected]:{},[t.LegendStateValue.selectedHover]:{},[t.LegendStateValue.unSelected]:{},[t.LegendStateValue.unSelectedHover]:{}};class ve extends be{constructor(e){super(i.merge({},ve.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 e=s.delegate;e.hasState(t.LegendStateValue.selected)?this._setLegendItemState(e,t.LegendStateValue.selectedHover):this._setLegendItemState(e,t.LegendStateValue.unSelectedHover);const i=e.getChildren()[0].find((e=>e.name===t.LEGEND_ELEMENT_NAME.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchEvent(t.LegendEvent.legendItemHover,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 e=s.delegate;e.removeState(t.LegendStateValue.unSelectedHover),e.removeState(t.LegendStateValue.selectedHover),e.getChildren()[0].getChildren().forEach((e=>{e.removeState(t.LegendStateValue.unSelectedHover),e.removeState(t.LegendStateValue.selectedHover)}));const i=e.getChildren()[0].find((e=>e.name===t.LEGEND_ELEMENT_NAME.focus),!1);i&&i.setAttribute("visible",!1),this._dispatchEvent(t.LegendEvent.legendItemUnHover,e)}},this._onClick=e=>{var i,s,a,n,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 e=l.delegate;if(l.name===t.LEGEND_ELEMENT_NAME.focus){const i=e.hasState(t.LegendStateValue.focus);e.toggleState(t.LegendStateValue.focus),i?null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((e=>{this._removeLegendItemState(e,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover,t.LegendStateValue.focus]),this._setLegendItemState(e,t.LegendStateValue.selected)})):(this._setLegendItemState(e,t.LegendStateValue.selected),this._removeLegendItemState(e,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover]),null===(a=this._itemsContainer)||void 0===a||a.getChildren().forEach((i=>{e!==i&&(this._removeLegendItemState(i,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover,t.LegendStateValue.focus]),this._setLegendItemState(i,t.LegendStateValue.unSelected))})))}else{null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{e.removeState(t.LegendStateValue.focus)}));const{selectMode:i="multiple",allowAllCanceled:s=!0}=this.attribute,a=e.hasState(t.LegendStateValue.selected),l=this._getSelectedLegends();if("multiple"===i){if(!1===s&&a&&1===l.length)return void this._dispatchEvent(t.LegendEvent.legendItemClick,e);a?(this._removeLegendItemState(e,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover]),this._setLegendItemState(e,t.LegendStateValue.unSelected)):(this._setLegendItemState(e,t.LegendStateValue.selected),this._removeLegendItemState(e,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover]))}else this._setLegendItemState(e,t.LegendStateValue.selected),this._removeLegendItemState(e,[t.LegendStateValue.unSelected,t.LegendStateValue.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((i=>{e!==i&&(this._removeLegendItemState(i,[t.LegendStateValue.selected,t.LegendStateValue.selectedHover]),this._setLegendItemState(i,t.LegendStateValue.unSelected))}))}this._dispatchEvent(t.LegendEvent.legendItemClick,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:a,maxCol:n=1,maxRow:r=2}=this.attribute;if(!1===t.visible||i.isEmpty(s))return;let l=s;a&&(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,p="horizontal"===d,{spaceCol:v=re,spaceRow:g=le,maxWidth:_,width:y,height:m}=t;i.isValid(_)?i.isValid(y)?this._itemWidthByUser=Math.min(_,y):this._itemWidthByUser=_:i.isValid(y)&&(this._itemWidthByUser=y),i.isValid(m)&&(this._itemHeightByUser=m);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),a=s.attribute.width,d=s.attribute.height;this._itemHeight=Math.max(this._itemHeight,d),f=Math.max(a,f),this._itemMaxWidth=Math.max(a,this._itemMaxWidth),p?(E=r,i.isValid(h)&&(a>=h?(x=!0,e>0&&(A=0,S+=d+g,L+=1)):h<A+a&&(x=!0,A=0,S+=d+g,L+=1)),e>0&&s.setAttributes({x:A,y:S}),A+=v+a):(E=n,i.isValid(u)&&u<S+d&&(x=!0,S=0,A+=f+v,f=0,L+=1),e>0&&s.setAttributes({x:A,y:S}),S+=g+d),o.add(s)}));let k=!1;x&&b&&L>E&&(k=this._renderPager(p)),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,a,n,r){const{id:l,label:o,value:d,shape:h}=s,{padding:u=0,focus:c,focusIconStyle:b={}}=this.attribute.item;let{shape:p={},label:v={},value:g={},background:_={}}=this.attribute.item;p=this._handleStyle(p,s,a,n,r),v=this._handleStyle(v,s,a,n,r),g=this._handleStyle(g,s,a,n,r),_=this._handleStyle(_,s,a,n,r);const y=i.normalizePadding(u);let m;!1===_.visible?(m=e.createGroup({x:0,y:0,cursor:(null==_?void 0:_.style).cursor}),this._appendDataToShape(m,t.LEGEND_ELEMENT_NAME.item,s,m)):(m=e.createGroup({x:0,y:0,...null==_?void 0:_.style}),this._appendDataToShape(m,t.LEGEND_ELEMENT_NAME.item,s,m,null==_?void 0:_.state)),m.addState(a?t.LegendStateValue.selected:t.LegendStateValue.unSelected);const x=e.createGroup({x:0,y:0,pickable:!1});m.add(x);let f=0;const A=i.get(p,"style.size",10),S=i.get(p,"space",8),E=e.createSymbol({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0,...h,...p.style});let L;Object.keys(p.state||{}).forEach((t=>{const e=p.state[t].fill||p.state[t].stroke;h.fill&&i.isNil(p.state[t].fill)&&e&&(p.state[t].fill=e),h.stroke&&i.isNil(p.state[t].stroke)&&e&&(p.state[t].stroke=e)})),this._appendDataToShape(E,t.LEGEND_ELEMENT_NAME.itemShape,s,m,null==p?void 0:p.state),E.addState(a?t.LegendStateValue.selected:t.LegendStateValue.unSelected),x.add(E);let k=0;if(c){const a=i.get(b,"size",10);L=e.createSymbol({x:0,y:-a/2-1,strokeBoundsBuffer:0,...b,visible:!1,pickMode:"imprecise",boundsPadding:y}),this._appendDataToShape(L,t.LEGEND_ELEMENT_NAME.focus,s,m),k=a}const B=e.createText({x:A/2+S,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(o,s,n):o});this._appendDataToShape(B,t.LEGEND_ELEMENT_NAME.itemLabel,s,m,null==v?void 0:v.state),B.addState(a?t.LegendStateValue.selected:t.LegendStateValue.unSelected),x.add(B);const M=i.get(v,"space",8);if(f+=A/2+S+B.AABBBounds.width()+M,i.isValid(d)){const r=i.get(g,"space",c?8:0),l=e.createText({x:f+M,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==g?void 0:g.style).fontSize,...null==g?void 0:g.style,text:g.formatMethod?g.formatMethod(d,s,n):d});this._appendDataToShape(l,t.LEGEND_ELEMENT_NAME.itemValue,s,m,null==g?void 0:g.state),l.addState(a?t.LegendStateValue.selected:t.LegendStateValue.unSelected),this._itemWidthByUser&&(l.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-A-S-B.AABBBounds.width()-M-k-r),g.alignRight&&l.setAttributes({textAlign:"right",x:this._itemWidthByUser-A/2-y[1]-y[3]-k-r})),f=l.AABBBounds.x2+r,x.add(l)}else this._itemWidthByUser&&B.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[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+y[1]+y[3],I=this._itemHeightByUser||C+y[0]+y[2];return m.attribute.width=P,m.attribute.height=I,x.translateTo(-w.x1+y[3],-w.y1+y[0]),m}_renderPager(t){const s=this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",8):0,{maxWidth:a,maxHeight:n,maxCol:r=1,maxRow:l=2,item:o={},pager:d={}}=this.attribute,{spaceCol:h=re,spaceRow:u=le}=o,c=this._itemsContainer,{animation:b=!0,animationDuration:p=450,animationEasing:v="quadIn",space:g=de,..._}=d;let y,m=0,x=0,f=0,A=0,S=1;if(t){if(y=new ne({layout:1===l?"horizontal":"vertical",total:99,...i.merge({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},_)}),this._pager=y,this._innerView.add(y),m=(l-1)*u+this._itemHeight*l,x=a-y.AABBBounds.width()-g,x<=0)return this._innerView.removeChild(y),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;x<f+i&&(f=0,A+=s+u,S+=1),e>0&&t.setAttributes({x:f,y:A}),f+=h+i})),y.setAttributes({total:Math.ceil(S/l),x:x,y:s+m/2-y.AABBBounds.height()/2})}else{if(y=new ne({layout:"horizontal",total:99,..._}),this._pager=y,this._innerView.add(y),x=this._itemMaxWidth*r+(r-1)*h,m=n-y.AABBBounds.height()-g-s,m<=0)return this._innerView.removeChild(y),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;m<A+i&&(A=0,f+=this._itemMaxWidth+h,S+=1),e>0&&t.setAttributes({x:f,y:A}),A+=u+i})),y.setAttributes({total:Math.ceil(S/r),x:(x-y.AABBBounds.width())/2,y:n-y.AABBBounds.height()})}d.defaultCurrent>1&&(t?c.setAttribute("y",-(d.defaultCurrent-1)*(m+u)):c.setAttribute("x",-(d.defaultCurrent-1)*(x+h)));const E=e.createGroup({x:0,y:s,width:x,height:m,clip:!0,pickable:!1});E.add(c),this._innerView.add(E);const L=e=>{const{current:i}=e.detail;b?c.animate().to(t?{y:-(i-1)*(m+u)}:{x:-(i-1)*(x+h)},p,v):t?c.setAttribute("y",-(i-1)*(m+u)):c.setAttribute("x",-(i-1)*(x+h))};return this._pager.addEventListener("toPrev",L),this._pager.addEventListener("toNext",L),!0}_setLegendItemState(e,i,s=!0){e.addState(i,s),e.getChildren()[0].getChildren().forEach((e=>{e.name!==t.LEGEND_ELEMENT_NAME.focus&&e.addState(i,s)}))}_removeLegendItemState(e,i){i.forEach((t=>{e.removeState(t)})),e.getChildren()[0].getChildren().forEach((e=>{e.name!==t.LEGEND_ELEMENT_NAME.focus&&i.forEach((t=>{e.removeState(t)}))}))}_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,a,n={}){t.name=e,t.data=s,t.delegate=a,t.states=i.merge({},pe,n)}_dispatchEvent(i,s){var a;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const r=n.map((t=>t.label)),l=new e.CustomEvent(i,{item:s,data:s.data,selected:s.hasState(t.LegendStateValue.selected),currentSelectedItems:n,currentSelected:r});l.manager=null===(a=this.stage)||void 0===a?void 0:a.eventSystem.manager,this.dispatchEvent(l)}_handleStyle(t,e,s,a,n){const r=i.merge({},t);return t.style&&i.isFunction(t.style)&&(r.style=t.style(e,s,a,n)),t.state&&Object.keys(t.state).forEach((l=>{t.state[l]&&i.isFunction(t.state[l])&&(r.state[l]=t.state[l](e,s,a,n))})),r}}var ge;function _e(t){return i.isArray(t)?t:[t,t]}function ye(t){return t?"ew-resize":"ns-resize"}ve.defaultAttributes={layout:"horizontal",title:{align:"start",space:oe,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:re,spaceRow:le,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:de,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},t.SLIDER_ELEMENT_NAME=void 0,(ge=t.SLIDER_ELEMENT_NAME||(t.SLIDER_ELEMENT_NAME={})).innerView="innerView",ge.railContainer="sliderRailContainer",ge.rail="sliderRail",ge.startText="sliderStartText",ge.endText="sliderEndText",ge.startHandler="sliderStartHandler",ge.startHandlerText="startHandlerText",ge.endHandler="sliderEndHandler",ge.endHandlerText="sliderEndHandlerText",ge.track="sliderTrack",ge.trackContainer="sliderTrackContainer";class me extends n{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({},me.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:a,railHeight:n,min:r,max:l}=this.attribute;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=a):(o=t.clientY,u=o-this._prePos,d=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=n);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:a,max:n}=this.attribute,{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*(n-a)+a;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*(n-a)+a;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:a,max:n}=this.attribute,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*(n-a)+a;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[e,s]=i.array(t),{layout:a,railWidth:n,railHeight:r,min:l,max:o}=this.attribute,{startHandler:d,endHandler:h}=this._getHandlers(),u="vertical"===a?r:n,c=(e-l)/(o-l)*u;if(d&&this._updateHandler(d,c,e),h){const t=(s-l)/(o-l)*u;this._updateHandler(h,t,s)}this._updateTrack()}render(){var s,a;this.removeAllChild();const{layout:n="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:_e(b)[0],endValue:_e(b)[1]};const p="horizontal"===n;this._isHorizontal=p;const v=e.createGroup({x:0,y:0});v.name=t.SLIDER_ELEMENT_NAME.innerView,this.add(v),this._innerView=v;let g,_=0;if(o&&o.visible){g=e.createText({x:p?0:r/2,y:p?l/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:o.text,lineHeight:null===(s=o.style)||void 0===s?void 0:s.fontSize,...o.style}),g.name=t.SLIDER_ELEMENT_NAME.startText,v.add(g);const a=i.isValid(o.space)?o.space:0;_+=(p?g.AABBBounds.width():g.AABBBounds.height())+a}const y=e.createGroup({x:p?_:0,y:p?0:_});v.add(y);const m=e.createGroup({x:0,y:0});let x;if(m.name=t.SLIDER_ELEMENT_NAME.railContainer,this._railContainer=m,y.add(m),this._renderRail(m),_+=p?r:l,d&&d.visible){const s=i.isValid(d.space)?d.space:0;x=e.createText({x:p?_+s:r/2,y:p?l/2:_+s,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:d.text,lineHeight:null===(a=d.style)||void 0===a?void 0:a.fontSize,...d.style}),x.name=t.SLIDER_ELEMENT_NAME.endText,v.add(x)}this._renderTrack(m),c&&(this._renderHandlers(y),this._bindEvents())}_renderRail(i){const{railWidth:s,railHeight:a,railStyle:n,slidable:r}=this.attribute;let l="default";!1!==r&&(l="pointer");const o=e.createRect({x:0,y:0,width:s,height:a,cursor:l,...n});return o.name=t.SLIDER_ELEMENT_NAME.rail,i.add(o),this._rail=o,o}_renderHandlers(e){const{range:s,min:a,max:n,handlerSize:r=14,handlerStyle:l,handlerText:o,railHeight:d,railWidth:h,slidable:u}=this.attribute;let{value:c}=this.attribute;i.isNil(c)&&(c=[a,n]);const b=o&&o.visible,p=this._isHorizontal,v=p?h:d,[g,_]=_e(c),y=(g-a)/(n-a)*v,m=this._renderHandler({x:p?y:h/2,y:p?d/2:y,size:r,strokeBoundsBuffer:0,cursor:!1===u?"default":ye(p),...l});if(m.name=t.SLIDER_ELEMENT_NAME.startHandler,this._startHandler=m,e.add(m),this._currentValue.startPos=y,b){const i=this._renderHandlerText(g);i.name=t.SLIDER_ELEMENT_NAME.startHandlerText,e.add(i),this._startHandlerText=i}if(s){const i=(_-a)/(n-a)*v,s=this._renderHandler({x:p?i:h/2,y:p?d/2:i,size:r,strokeBoundsBuffer:0,cursor:!1===u?"default":ye(p),...l});if(s.name=t.SLIDER_ELEMENT_NAME.endHandler,this._endHandler=s,e.add(s),this._currentValue.endPos=i,b){const i=this._renderHandlerText(_);i.name=t.SLIDER_ELEMENT_NAME.endHandlerText,e.add(i),this._endHandlerText=i}}}_renderTrack(s){const{range:a,min:n,max:r,railHeight:l,railWidth:o,trackStyle:d,railStyle:h,slidable:u}=this.attribute;let{value:c}=this.attribute;i.isNil(c)&&(c=[n,r]);const b=this._isHorizontal,p=b?o:l;let[v,g]=_e(c);a||(v=n);const _=e.createGroup({x:0,y:0,width:o,height:l,cornerRadius:null==h?void 0:h.cornerRadius,clip:!0,pickable:!1});_.name=t.SLIDER_ELEMENT_NAME.trackContainer;const y=i.isObject(a)&&!0===a.draggableTrack;let m;m=!1===u?"default":!1===a||!1===y?"pointer":ye(b);const x=(g-v)/(r-n)*p,f=e.createRect({x:b?(v-n)/(r-n)*p:0,y:b?0:(v-n)/(r-n)*p,width:b?x:o,height:b?l:x,cursor:m,...d});f.name=t.SLIDER_ELEMENT_NAME.track,this._track=f,_.add(f),s.add(_)}_renderHandler(t){return e.createSymbol(t)}_renderHandlerText(t){var i,s,a;const{align:n,min:r,max:l,handlerSize:o=14,handlerText:d={},railHeight:h,railWidth:u,slidable:c}=this.attribute,b=this._isHorizontal,p=(t-r)/(l-r)*(b?u:h),v=null!==(i=d.space)&&void 0!==i?i:4,g={text:(null==d?void 0:d.formatter)?d.formatter(t):t.toFixed(null!==(s=null==d?void 0:d.precision)&&void 0!==s?s:0),lineHeight:null===(a=d.style)||void 0===a?void 0:a.lineHeight,cursor:!1===c?"default":ye(b),...d.style};b?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=p,g.y=(h-o)/2-v):(g.textBaseline="top",g.textAlign="center",g.x=p,g.y=(h+o)/2+v):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(u-o)/2-v,g.y=p):(g.textBaseline="middle",g.textAlign="start",g.x=(u+o)/2+v,g.y=p);return e.createText(g)}_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 a;const n=this._isHorizontal;e.setAttribute(n?"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!==(a=null==t?void 0:t.precision)&&void 0!==a?a:0),[n?"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 a;const n=this._isHorizontal,{handlerText:r}=this.attribute;e.setAttributes({[n?"x":"y"]:i,text:(null==r?void 0:r.formatter)?r.formatter(s):s.toFixed(null!==(a=null==r?void 0:r.precision)&&void 0!==a?a:0)});const l=e.name===t.SLIDER_ELEMENT_NAME.startHandlerText?this._startHandler:this._endHandler;l&&(null==l||l.setAttributes({[n?"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,a=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});a.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(a)}_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}}}me.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 xe extends be{constructor(t){super(i.merge({},xe.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:a,align:n,min:r,max:l,value:o,railWidth:d,railHeight:h,showHandler:u=!0,handlerSize:c,handlerStyle:b,railStyle:p,trackStyle:v,startText:g,endText:_,handlerText:y,showTooltip:m,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 me({x:0,y:0,range:{draggableTrack:!0},slidable:e,layout:a,align:n,min:r,max:l,value:o,railWidth:d,railHeight:h,showHandler:u,handlerSize:c,handlerStyle:b,railStyle:p,trackStyle:{fill:this._color,...v},startText:g,endText:_,handlerText:y,showTooltip:m,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",oe):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 a=[];for(let e=0;e<s;e++){const i=e/(s-1);a.push({offset:i,color:t[e]})}const n="horizontal"===e;return{gradient:"linear",stops:a,x0:0,y0:0,x1:n?1:0,y1:n?0:1}}_updateColor(){const{layout:t="horizontal",colors:e,railWidth:i,railHeight:s}=this.attribute,{startHandler:a,endHandler:n,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==a||a.setAttribute("fill",u),null==n||n.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,a=i/b,n=a-s,u=t.filter((t=>t.offset>s&&t.offset<a)),c=Math.min(l,o),p=Math.max(l,o),v=this._colorScale.scale(c),g=this._colorScale.scale(p),_=[{offset:0,color:v}];u.forEach((t=>{_.push({offset:(t.offset-s)/n,color:t.color})})),_.push({offset:1,color:g}),r.setAttribute("fill",{...this._color,stops:_})}}}function fe(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`}xe.defaultAttributes={layout:"horizontal",title:{align:"start",space:oe,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 Ae extends be{constructor(t){super(i.merge({},Ae.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:a,min:n,max:r,value:l,railWidth:o,railHeight:d,showHandler:h=!0,handlerSize:u,handlerStyle:c,railStyle:b,trackStyle:p,startText:v,endText:g,handlerText:_,showTooltip:y,tooltip:m,sizeBackground:x}=this.attribute,f=e.createGroup({x:0,y:0});this._innerView.add(f);const A=new me({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:s,align:a,min:n,max:r,value:l,railWidth:o,railHeight:d,showHandler:h,handlerSize:u,handlerStyle:{symbolType:fe(a),...c},railStyle:b,trackStyle:p,startText:v,endText:g,handlerText:_,showTooltip:y,tooltip:m});f.add(A);let S,E=0;const L=12;"horizontal"===s?"top"===a?(S=`M0,0L${o},0L${o},12Z`,E=d):(S=`M0,12L${o},12L${o},0Z`,A.setAttribute("y",L)):"left"===a?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({x:0,y:E,path:S,...x,zIndex:0});f.add(k);const B=this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",oe):0;f.translate(0-f.AABBBounds.x1,B-f.AABBBounds.y1),this._slider=A}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}Ae.defaultAttributes={layout:"horizontal",title:{align:"start",space:oe,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 Se extends n{constructor(t){super(i.merge({},Se.defaultAttributes,t)),this.name="title"}render(){var t,e,s,a,n,r,l,o,d,h,u,c,b,p,v,g,_,y,m,x,f,A,S,E,L,k,B,M,w,T,C,P,I,H,z,V,R,N,D,O,$,U,W,F,G,Y,X,q,Z,j,J,K,Q,tt,et,it,st,at,nt,rt,lt,ot;const{text:dt,textStyle:ht,subtext:ut,subtextStyle:ct,width:bt,height:pt,minWidth:vt,maxWidth:gt,minHeight:_t,maxHeight:yt,align:mt,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!==(n=null!==(a=ht.width)&&void 0!==a?a:bt)&&void 0!==n?n:0,height:null!==(l=null!==(r=ht.height)&&void 0!==r?r:pt)&&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",{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===(p=this.attribute)||void 0===p?void 0:p.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&i.isValid(null==ct?void 0:ct.character)){const t={x:null!==(v=ct.x)&&void 0!==v?v:0,y:null!==(g=ct.y)&&void 0!==g?g:Et,width:null!==(y=null!==(_=ct.width)&&void 0!==_?_:bt)&&void 0!==y?y:0,height:null!==(x=null!==(m=ct.height)&&void 0!==m?m:pt)&&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",{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,Bt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.width():0;let Mt=Math.max(Lt,Bt),wt=Et+(null!==(B=null==ct?void 0:ct.height)&&void 0!==B?B:kt);if(i.isValid(bt)&&(Mt=bt,null===(M=this._mainTitle)||void 0===M||M.setAttribute("maxLineWidth",bt),null===(w=this._subTitle)||void 0===w||w.setAttribute("maxLineWidth",bt)),i.isValid(pt)&&(wt=pt),i.isValid(vt)&&Mt<vt&&(Mt=vt),i.isValid(gt)&&(null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",gt),null===(C=this._subTitle)||void 0===C||C.setAttribute("maxLineWidth",gt),null===(P=this._mainTitle)||void 0===P||P.setAttribute("maxWidth",gt),null===(I=this._subTitle)||void 0===I||I.setAttribute("maxWidth",gt),Mt>gt&&(Mt=gt)),i.isValid(_t)&&wt<_t&&(wt=_t),i.isValid(yt)&&(null===(H=this._mainTitle)||void 0===H||H.setAttribute("maxHeight",yt),null===(z=this._subTitle)||void 0===z||z.setAttribute("maxHeight",yt-Et),wt>yt&&(wt=yt)),St.attribute.width=Mt+At[1]+At[3],St.attribute.height=wt+At[0]+At[2],i.isValid(mt)||i.isValid(null==ht?void 0:ht.align)){const t=(null==ht?void 0:ht.align)?null==ht?void 0:ht.align:mt,e=null!==(V=null==ht?void 0:ht.width)&&void 0!==V?V:Lt;"left"===t?(null===(R=this._mainTitle)||void 0===R||R.setAttribute("x",0),null===(N=this._mainTitle)||void 0===N||N.setAttribute("textAlign","left")):"center"===t?(null===(D=this._mainTitle)||void 0===D||D.setAttribute("x",e/2),null===(O=this._mainTitle)||void 0===O||O.setAttribute("textAlign","center")):"right"===t&&(null===($=this._mainTitle)||void 0===$||$.setAttribute("x",e),null===(U=this._mainTitle)||void 0===U||U.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:Mt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(F=this._mainTitle)||void 0===F||F.setAttribute("textBaseline","top")):"middle"===t?(null===(G=this._mainTitle)||void 0===G||G.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===(q=this._mainTitle)||void 0===q||q.setAttribute("textBaseline","bottom"))}if(i.isValid(mt)||i.isValid(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:mt,e=null!==(Z=null==ct?void 0:ct.width)&&void 0!==Z?Z:Bt;"left"===t?(null===(j=this._subTitle)||void 0===j||j.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===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","top")):"middle"===t?(null===(nt=this._subTitle)||void 0===nt||nt.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"))}}}Se.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 Ee={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 Le=(t,e)=>{let i=t.x0,s=t.x1;const a="number"==typeof e?t.thickness*e:t.thickness;let n=t.y0-t.thickness/2,r=t.y1-t.thickness/2;"center"===t.align?(n=t.y0-a/2,r=t.y1-a/2):"end"===t.align&&(n=t.y0+t.thickness/2-a,r=t.y1+t.thickness/2-a);let l=(i+s)/2,o=n+a,d=r+a;t.round&&(i=Math.round(i),s=Math.round(s),n=Math.round(n),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-a/2}L${s+a},${(r+d)/2}L${s},${d+a/2}`:"",c=t.startArrow&&h?`L${i},${o+a/2}L${i-a},${(n+o)/2}L${i},${n-a/2}`:"";return!1===t.isSmooth?`M${i},${n}L${s},${r}${u}L${s},${d}L${i},${o}${c}Z`:`M${i},${n}\n C${l},${n},${l},${r},${s},${r}\n ${u}\n L${s},${d}\n C${l},${d},${l},${o},${i},${o}\n ${c}\n Z`},ke=(t,e)=>{let i=t.y0,s=t.y1,a=t.x0-t.thickness/2,n=t.x1-t.thickness/2;const r="number"==typeof e?t.thickness*e:t.thickness;"center"===t.align?(a=t.x0-r/2,n=t.x1-r/2):"end"===t.align&&(a=t.x0+t.thickness/2-r,n=t.x1+t.thickness/2-r);let l=(i+s)/2,o=a+r,d=n+r;t.round&&(i=Math.round(i),s=Math.round(s),a=Math.round(a),n=Math.round(n),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${n-r/2},${s}L${(n+d)/2},${s+r}L${d+r/2},${s}`:"",c=t.startArrow&&h?`L${o+r/2},${i}L${(o+a)/2},${i-r}L${a-r/2},${i}`:"";return!1===t.isSmooth?`M${a},${i}L${n},${s}${u}L${d},${s}L${o},${i}${c}Z`:`M${a},${i}\n C${a},${l},${n},${l},${n},${s}\n ${u}\n L${d},${s}\n C${d},${l},${o},${l},${o},${i}\n ${c}\n Z`};class Be extends n{constructor(t){super(i.merge({},Be.defaultAttributes,t))}render(){const{direction:t="horizontal"}=this.attribute,e="vertical"===t?ke:Le,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"],a={};if(Object.keys(this.attribute).forEach((t=>{s.includes(t)||(a[t]=this.attribute[t])})),i){const t=this.createOrUpdateChild("sankey-link-background",Object.assign({},a,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 n=this.createOrUpdateChild("sankey-link-front",Object.assign({},a,{path:e(this.attribute,i?this.attribute.ratio:1),pickable:!1}),"path");this._frontPath=n}}Be.defaultAttributes={direction:"horizontal",align:"start"};class Me extends e.Symbol{constructor(t){super(t)}}var we,Te;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(we||(we={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(Te||(Te={}));class Ce extends n{constructor(t){super(i.merge({},Ce.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:{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",...Ce.defaultControllerAttr,...this.attribute.start.style}},this._pauseAttr={style:{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",...Ce.defaultControllerAttr,...this.attribute.pause.style}},this._forwardAttr={style:{...Ce.defaultControllerAttr,...this.attribute.forward.style}},this._backwardAttr={style:{...Ce.defaultControllerAttr,...this.attribute.backward.style}},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s,a,n,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!==(n=null===(a=this._backwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==n?n:"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 Me({...this._startAttr.style}),this.add(this._playController))},this._initBackward=()=>{i.isNil(this._backwardController)&&(this._backwardController=new Me({...this._backwardAttr.style}),this.add(this._backwardController))},this._initForward=()=>{i.isNil(this._forwardController)&&(this._forwardController=new Me({...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({symbolType:this._playController.getComputedAttribute("symbolType"),...this._startAttr.style}):this._playController.setAttributes({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(we.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(we.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(we.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(we.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()}}Ce.defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},Ce.defaultAttributes={visible:!0,[Te.Start]:{},[Te.Pause]:{},[Te.Backward]:{},[Te.Forward]:{}};const Pe={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},Ie=[200,10];var He,ze;t.DirectionEnum=void 0,(He=t.DirectionEnum||(t.DirectionEnum={})).Default="default",He.Reverse="reverse",t.PlayerEventEnum=void 0,(ze=t.PlayerEventEnum||(t.PlayerEventEnum={})).OnChange="onChange",ze.OnPlay="onPlay",ze.OnPause="onPause",ze.OnBackward="onBackward",ze.OnForward="onForward",ze.OnEnd="onEnd";const Ve=({direction:e,maxIndex:i,minIndex:s,dataIndex:a})=>(({direction:e,maxIndex:i,dataIndex:s})=>e===t.DirectionEnum.Default&&s===i)({direction:e,maxIndex:i,dataIndex:a})||(({direction:e,minIndex:i,dataIndex:s})=>e===t.DirectionEnum.Reverse&&s===i)({direction:e,minIndex:s,dataIndex:a}),Re=({direction:e,maxIndex:i,minIndex:s,dataIndex:a})=>(({direction:e,minIndex:i,dataIndex:s})=>e===t.DirectionEnum.Default&&s===i)({direction:e,minIndex:s,dataIndex:a})||(({direction:e,maxIndex:i,dataIndex:s})=>e===t.DirectionEnum.Reverse&&s===i)({direction:e,maxIndex:i,dataIndex:a}),Ne=t=>"top"===t||"bottom"===t;class De extends n{constructor(t){super(i.merge({},De.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,s;let a;i.isValidNumber(this._handlerStyle.size)?a=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(a=i.max(this._handlerStyle.size[0],this._handlerStyle.size[1]));const n={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(a)?a:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(Ne(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:Ie[1];n.layout="horizontal",n.railHeight=i,n.railWidth=t,n.x=this._layoutInfo.slider.x,n.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:Ie[1];n.layout="vertical",n.railWidth=e,n.railHeight=t,n.x=this._layoutInfo.slider.x,n.y=this._layoutInfo.slider.y}return n},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new me(t),this.add(this._slider)},this._updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return Ne(this._orient)?(t.layout="horizontal",t.start={style:{...t.start.style,x:this._layoutInfo.start.x,y:this._layoutInfo.start.y}},t.pause={style:{...t.pause.style,x:this._layoutInfo.start.x,y:this._layoutInfo.start.y}},t.backward={style:{...t.backward.style,x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y}},t.forward={style:{...t.forward.style,x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y}}):(t.layout="vertical",t.start={style:{...t.start.style,x:this._layoutInfo.start.x,y:this._layoutInfo.start.y}},t.pause={style:{...t.pause.style,x:this._layoutInfo.start.x,y:this._layoutInfo.start.y}},t.backward={style:{...t.backward.style,x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y}},t.forward={style:{...t.forward.style,x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y}}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new Ce(t),this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,s,a,n,r,l,o,d,h,u,c,b;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._railStyle={...null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.railStyle},this._trackStyle={...null===(s=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===s?void 0:s.trackStyle},this._handlerStyle={...null===(n=null===(a=this.attribute)||void 0===a?void 0:a.slider)||void 0===n?void 0:n.handlerStyle},this._start={...null===(l=null===(r=this.attribute)||void 0===r?void 0:r.controller)||void 0===l?void 0:l.start},this._pause={...null===(d=null===(o=this.attribute)||void 0===o?void 0:o.controller)||void 0===d?void 0:d.pause},this._forward={...null===(u=null===(h=this.attribute)||void 0===h?void 0:h.controller)||void 0===u?void 0:u.forward},this._backward={...null===(b=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===b?void 0:b.backward}}_initLayoutInfo(){var t,e,s;const a=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=a.filter((t=>"end"!==t.position)),r=a.filter((t=>"end"===t.position)),l=null!==(t=Ne(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:Ie[1],o=a.reduce(((t,e)=>{const s=e.style.size,a=i.isNumber(s)?s:i.max(s[0],s[1]);return t+e.space+a}),0),d=(Ne(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,h=d-this.attribute.slider.space,u=n.reduce(((t,e)=>{const{key:s,space:a,style:{size:n}}=e,r=i.isNumber(n)?n:i.max(n[0],n[1]);return this._layoutInfo[s]={...this._layoutInfo[s],size:r,x:Ne(this._orient)?t+a:(this._size.width-r)/2,y:Ne(this._orient)?(this._size.height-r)/2:t+a},t+a+r}),0);this._layoutInfo.slider={...this._layoutInfo.slider,size:h,x:Ne(this._orient)?u+this.attribute.slider.space:(this._size.width-l)/2,y:Ne(this._orient)?(this._size.height-l)/2:u+this.attribute.slider.space},r.reduce(((t,e)=>{const{key:s,space:a,style:{size:n}}=e,r=i.isNumber(n)?n:i.max(n[0],n[1]);return this._layoutInfo[s]={...this._layoutInfo[s],size:r,x:Ne(this._orient)?t+a:(this._size.width-r)/2,y:Ne(this._orient)?(this._size.height-r)/2:t+a},t+a+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 a=new e.CustomEvent(t,{eventType:t,index:i,value:this._data[i]});a.manager=null===(s=this.stage)||void 0===s?void 0:s.eventSystem.manager,this.dispatchEvent(a)}}De.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:{...Pe,key:"start",position:"start",space:0},pause:{...Pe,key:"pause",position:"start"},forward:{...Pe,key:"forward",position:"end"},backward:{...Pe,key:"backward",position:"start"}}};var Oe;t.IOperateType=void 0,(Oe=t.IOperateType||(t.IOperateType={})).drawStart="drawStart",Oe.drawEnd="drawEnd",Oe.drawing="drawing",Oe.moving="moving",Oe.moveStart="moveStart",Oe.moveEnd="moveEnd",Oe.brushClear="brushClear";const $e={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}},Ue=5,We={debounce:i.debounce,throttle:i.throttle};class Fe extends n{constructor(e){super(i.merge({},Fe.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",We[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:a=[],dx:n=0,dy:r=0}=s[t].attribute,l=a.map((t=>({x:t.x+n,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:a}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:l=-1/0,maxX:o=1/0}=a,{x1:d,x2:h,y1:u,y2:c}=this._operatingMask.globalAABBBounds,b=l-d,p=o-h,v=n-u,g=r-c;this._operatingMaskMoveRangeX=[b,p],this._operatingMaskMoveRangeY=[v,g],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:a=0,x2:n=0,y1:r=0,y2:l=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds,{sizeThreshold:o=Ue}=this.attribute;if(this._isDrawedBeforeEnd=!!(Math.abs(n-a)>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 a=s.x-i.x,n=s.y-i.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],a))+this._operatingMaskMoveDx,l=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+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 a=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return a="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:s[0]},{x:r.x,y:s[0]},{x:r.x,y:s[1]},{x:n.x,y:s[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:i.cloneDeep(this._cacheDrawPoints),a}_addBrushMask(){const{brushStyle:t}=this.attribute,s=e.createPolygon({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:a=-1/0,maxX:n=1/0}=e,r=this.eventPosToStagePos(t);return r.x>n||r.x<a||r.y>s||r.y<i}eventPosToStagePos(t){var e,i,s;const a=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==a?void 0:a.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==a?void 0:a.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)}}Fe.defaultAttributes=$e;const Ge=(t,...e)=>{const s=[t.shape,...e.map((t=>null==t?void 0:t.shape))],a=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[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:a.every(i.isNil)?void 0:i.merge({},...a),value:n.every(i.isNil)?void 0:i.merge({},...n)})},Ye=t=>{const{width:e,height:s,wordBreak:a="break-word",textAlign:n,textBaseline:r,text:l}=t;return{width:e,height:s,wordBreak:a,textAlign:n,textBaseline:r,singleLine:!1,textConfig:i.array(l).map((e=>({...t,text:e})))}},Xe={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:m,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:m,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:m,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"],Ze="tooltip-title",je="tooltip-content",Je="shape",Ke="value";class Qe extends n{constructor(t){super(i.merge({},Qe.defaultAttributes,t)),this.name="tooltip"}render(){const{visible:t,content:e,panel:s,keyWidth:a,valueWidth:n,hasContentShape:r,autoCalculatePosition:l,autoMeasure:d}=this.attribute;if(!t)return void this.hideAll();d&&Qe.measureTooltip(this.attribute),l&&Qe.calculateTooltipPosition(this.attribute);const h=i.normalizePadding(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",{visible:!0,...s},"rect"),this._tooltipTitleContainer=this.createOrUpdateChild(Ze,{visible:!0,x:h[3],y:h[0]},"group");const u=Qe.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild(`${Ze}-${Je}`,i.merge({symbolType:"circle"},u.shape,{visible:o(u)&&o(u.shape)}),"symbol"),u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild(`${Ze}-${Ke}`,{visible:o(u)&&o(u.value),...Ye(u.value)},"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild(`${Ze}-${Ke}`,{text:"",visible:o(u)&&o(u.value),...u.value},"text");const c=o(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:b,textBaseline:p}=u.value,v=s.width-h[3]-h[0]-c;"center"===b?this._tooltipTitle.setAttribute("x",c+v/2):"right"===b||"end"===b?this._tooltipTitle.setAttribute("x",c+v):this._tooltipTitle.setAttribute("x",c),"bottom"===p?this._tooltipTitle.setAttribute("y",u.height):"middle"===p?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const g=o(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild(je,{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==e?void 0:e.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+g);let t=0;e.forEach(((e,s)=>{var l;const d=Qe.getContentAttr(this.attribute,s);if(!o(d))return;const h=`${je}-${s}`,u=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:t},"group");let c=0;if(o(d.shape)&&u.createOrUpdateChild(`${h}-${Je}`,{visible:!0,x:d.shape.size/2,y:d.shape.size/2+((null!==(l=d.key.lineHeight)&&void 0!==l?l:d.key.fontSize)-d.shape.size)/2,...d.shape},"symbol"),r&&(c+=d.shape.size+d.shape.spacing),o(d.key)){let t;t=d.key.multiLine?u.createOrUpdateChild(`${h}-key`,{visible:!0,...Ye(d.key),textBaseline:"top"},"richtext"):u.createOrUpdateChild(`${h}-key`,{visible:!0,...d.key,textBaseline:"top"},"text");const{textAlign:e}=d.key;"center"===e?t.setAttribute("x",c+a/2):"right"===e||"end"===e?t.setAttribute("x",c+a):t.setAttribute("x",c),t.setAttribute("y",0),c+=a+d.key.spacing}if(o(d.value)){let t;t=d.value.multiLine?u.createOrUpdateChild(`${h}-${Ke}`,{visible:!0,...Ye(d.value),textBaseline:"top"},"richtext"):u.createOrUpdateChild(`${h}-${Ke}`,{visible:!0,...d.value,textBaseline:"top"},"text");let e="right";i.isValid(d.value.textAlign)?e=d.value.textAlign:o(d.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",c+n/2):"right"===e||"end"===e?t.setAttribute("x",c+n):t.setAttribute("x",c),c+=n,t.setAttribute("y",0),u.add(t)}t+=d.height+d.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&&Qe.measureTooltip(this.attribute),Qe.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:a,pointerX:n,pointerY:r,positionX:l,positionY:o,parentBounds:d}=t;let h=n,u=r;return"left"===l?h-=e+s:"center"===l?h-=e/2:h+=s,"top"===o?u-=i+a:"middle"===o?u-=i/2:u+=a,h+e>d.x2&&(h-=e+s),u+i>d.y2&&(u-=i+a),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:a}=t,n=i.normalizePadding(t.padding),r=Qe.getTitleAttr(t);let l=0,d=n[0]+n[2],h=0;const{value:u,shape:c}=r,{visible:b=!1,symbolType:p=""}=null!=c?c:{};if(i.isValid(u)){const{width:t,height:e}=A(u).quickMeasure(u.text);l=t,h=e}if(b&&e.builtinSymbolsMap[p]&&(l+=c.size+c.spacing,h=Math.max(c.size,h)),t.title&&(t.title.width=l,t.title.height=h),o(r)&&(d+=h+r.spaceRow),null==s?void 0:s.length){const i=[];if(s.forEach(((e,s)=>{const a=Qe.getContentAttr(t,s);(e.key||e.value)&&o(a)&&i.push([e,a])})),i.length){let n=!1;const r=[],h=[],u=[];i.forEach((([t,s],l)=>{var c;const{key:b,value:p,shape:v,spaceRow:g}=s,_=o(v),y=null!==(c=null==v?void 0:v.symbolType)&&void 0!==c?c:"",m=A(b),x=A(p);let f=0;if(o(b)){const{width:t,height:e}=m.quickMeasure(b.text);h.push(t),f=Math.max(f,e)}if(o(p)){const{width:t,height:e}=x.quickMeasure(p.text);u.push(t),f=Math.max(f,e)}_&&e.builtinSymbolsMap[y]&&(n=!0,r.push(v.size),f=Math.max(v.size,f)),t.height=f,d+=f,l<i.length-1&&(d+=null!=g?g:a.spaceRow)}));const c=r.length?Math.max(...r):0,b=h.length?Math.max(...h):0,p=u.length?Math.max(...u):0;l=Math.max(b+p+a.key.spacing+a.value.spacing+(n?c+a.shape.spacing:0),l),s.forEach((t=>{t.width=l})),t.hasContentShape=n,t.keyWidth=b,t.valueWidth=p}}return t.panel.width=l+n[1]+n[3],t.panel.height=d,t}static getTitleAttr(t){return Ge({},Qe.defaultAttributes.titleStyle,Qe.defaultAttributes.title,t.titleStyle,t.title)}static getContentAttr(t,e){return Ge({},Qe.defaultAttributes.contentStyle,t.contentStyle,t.content[e])}}Qe.defaultAttributes=Xe;t.AbstractComponent=n,t.ArcInfo=_t,t.ArcLabel=yt,t.BasePlayer=De,t.Brush=Fe,t.CircleAxis=Ot,t.CircleCrosshair=$,t.ColorContinuousLegend=xe,t.ContinuousPlayer=class extends De{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(we.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(we.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(we.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(we.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.OnChange))},this.play=async()=>{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.OnPlay),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.OnEnd)},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.OnPause))},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.OnBackward)},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.OnForward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}},t.DEFAULT_ITEM_SPACE_COL=re,t.DEFAULT_ITEM_SPACE_ROW=le,t.DEFAULT_LABEL_SPACE=8,t.DEFAULT_PAGER_SPACE=de,t.DEFAULT_SHAPE_SIZE=10,t.DEFAULT_SHAPE_SPACE=8,t.DEFAULT_STATES=Mt,t.DEFAULT_TITLE_SPACE=oe,t.DEFAULT_VALUE_SPACE=8,t.DataLabel=xt,t.DataZoom=Gt,t.DiscreteLegend=ve,t.DiscretePlayer=class extends De{constructor(s){super(i.merge({},s)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var e,s,a,n;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!==(a=this.attribute.direction)&&void 0!==a?a:t.DirectionEnum.Default,this._dataIndex=i.isNil(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(we.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(we.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(we.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(we.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.OnChange)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(Ve({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||Re({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.OnPlay),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.OnChange),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.OnChange)),("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.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,e.vglobal.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(t.PlayerEventEnum.OnPause))},this.backward=()=>{const e=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(e),this.dispatchCustomEvent(t.PlayerEventEnum.OnChange),this.dispatchCustomEvent(t.PlayerEventEnum.OnBackward)},this.forward=()=>{const e=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(e),this.dispatchCustomEvent(t.PlayerEventEnum.OnChange),this.dispatchCustomEvent(t.PlayerEventEnum.OnForward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}},t.Grid=Et,t.GroupFadeIn=Ut,t.GroupFadeOut=Wt,t.GroupTransition=$t,t.Indicator=class extends n{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:s,content:a,size:n,limitRatio:r=1/0}=this.attribute,l=Math.min(n.width,n.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(Ee,"title.style"),s.style);this._title=o.createOrUpdateChild("indicator-title",{...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(a)){const t=this._title&&(null==s?void 0:s.space)?s.space:0,e=i.array(a),n=[];let h=0;e.forEach(((e,s)=>{if(!1!==e.visible){const a=i.merge({},i.get(Ee,"content.style"),e.style),u=o.createOrUpdateChild("indicator-content-"+s,{...a,lineHeight:i.isValid(a.lineHeight)?a.lineHeight:a.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),n.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=n}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",n.height/2-h/2),o.setAttribute("x",n.width/2)}_setAutoFit(t,e,s){var a,n,r,l,o,d;const h=S(null!==(n=null===(a=s.style)||void 0===a?void 0:a.text)&&void 0!==n?n:"",null!==(r=s.style)&&void 0!==r?r:{}).width;if(h>0){const a=t*(null!==(l=s.fitPercent)&&void 0!==l?l:.5)/h,n=Math.floor((null!==(d=null===(o=s.style)||void 0===o?void 0:o.fontSize)&&void 0!==d?d:20)*a);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",i.isValid(s.style.lineHeight)?s.style.lineHeight:n)}}},t.LabelBase=dt,t.LineAxis=Dt,t.LineCrosshair=D,t.LineLabel=ct,t.LinkPath=Be,t.MarkArea=ie,t.MarkLine=ee,t.MarkPoint=se,t.Pager=ne,t.PolygonCrosshair=W,t.PopTip=L,t.RectCrosshair=O,t.RectLabel=ut,t.ScrollBar=r,t.SectorCrosshair=U,t.Segment=Lt,t.SizeContinuousLegend=Ae,t.Slider=me,t.SymbolLabel=ht,t.Tag=E,t.Title=Se,t.Tooltip=Qe,t.getHorizontalPath=Le,t.getSizeHandlerPath=fe,t.getVerticalPath=ke,t.loadPoptip=function(t){i.merge(I.poptip,t),e.container.load(R)},t.popTipModule=R,t.setPoptipTheme=function(t){i.merge(I.poptip,P,t)},t.version="0.14.1-alpha.4"}));
|