@visactor/vrender-components 0.13.11 → 0.13.13
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/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/poptip/poptip.js +3 -3
- package/cjs/poptip/poptip.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/poptip/poptip.js +3 -3
- package/es/poptip/poptip.js.map +1 -1
- package/package.json +4 -4
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:o,padding:l=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 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=d.createOrUpdateChild("slider",{...b,cornerRadius:this._getDefaultSliderCornerRadius(),...o,boundsPadding:i.normalizePadding(l),pickMode:"imprecise"},"rect");this._slider=g,this._container=d;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,o]=i.normalizePadding(s),l={x1:o,y1:a,x2:t-n,y2:e-r,width:t-(o+n),height:e-(a+r)};return this._sliderRenderBounds=l,l}_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:o,y1:l}=this._getSliderRenderBounds(),d=this._sliderSize;return"horizontal"===e?i.clampRange([o+s*n,o+a*n],o,n-d):i.clampRange([l+s*r,l+a*r],l,r-d)}_onRailPointerDown=t=>{const{viewX:e,viewY:s}=t,{direction:a,width:n,height:r,range:o}=this.attribute,l=this._sliderSize,[d,h]=this._getScrollRange();let c;if("vertical"===a){const t=s-this._viewPosition.y,e=i.clamp(t-l/2,d,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,s=i.clamp(t-l/2,d,h);c=t/n,this._slider.setAttribute("x",s,!0)}this.setScrollRange([c-(o[1]-o[0])/2,c+(o[1]-o[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:o}=this._getSliderRenderBounds();"vertical"===e?(s=t.clientY,a=s-this._prePos,i=a/o):(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 o(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&o(t,e)}))}const l=t=>!i.isNil(t)&&!1!==t.visible,d=["#ffffff","#000000"];function h(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(...d);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,o,l;r=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),l=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4);return.2126*r+.7152*o+.0722*l}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)),o=r&&(i*a+s*n)/r;return Math.acos(Math.min(Math.max(o,-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 m=-.5*Math.PI,y=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:o,padding:l=4,visible:d,state:h}=this.attribute,c=i.normalizePadding(l),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,m=0;const{visible:y,...x}=s;if(i.isBoolean(y)){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:y,x:e/2,y:e/2},"symbol"),i.isEmpty(h?.shape)||(p.states=h.shape),y&&(m=e+n)}b+=m,_+=m;const f={text:t,visible:i.isValid(t)&&!1!==d,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(h?.text)||(v.states=h.text);const A=S(f.text,e),E=A.width,k=A.height;b+=E;const B=s.size??10,w=i.isNumber(B)?B:Math.max(B[0],B[1]);g+=Math.max(k,s?.visible?w:0);const{textAlign:M,textBaseline:L}=e;(i.isValid(r)||i.isValid(o))&&(i.isValid(r)&&b<r&&(b=r),i.isValid(o)&&b>o&&(b=o,v.setAttribute("maxLineWidth",o-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",-m/2)):"right"===M||"end"===M?(T-=b,p&&p.setAttribute("x",(p.attribute.x||0)-E),u.setAttribute("x",-c[1]-m)):"left"!==M&&"start"!==M||u.setAttribute("x",c[3]),"middle"===L?(C-=g/2,p&&p.setAttribute("y",0)):"bottom"===L?(C-=g,p&&p.setAttribute("y",-k/2),u.setAttribute("y",-c[2])):"top"===L&&(u.setAttribute("y",c[0]),p&&p.setAttribute("y",k/2));const{visible:P,...I}=a;if(d&&i.isBoolean(P)){const e=this.createOrUpdateChild("tag-panel",{...I,visible:P&&!!t,x:T,y:C,width:b,height:g},"rect");i.isEmpty(h?.panel)||(e.states=h.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:o=4,minWidth:l=0,maxWidth:d=1/0,padding:h=4,visible:c,state:u,dx:p=0,dy:b=0}=this.attribute,g=i.normalizePadding(h),_=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group"),m=d-g[1]-g[3],y=i.isValid(t)&&!1!==c,x={text:t,visible:y,...e,x:g[3],y:g[0],maxLineWidth:m,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+o;y||(E=0);const k=i.isValid(a)&&!1!==c,B={text:a,visible:k,...n,x:g[3],y:g[0]+E,maxLineWidth:m,textAlign:"left",textBaseline:"top"},w=_.createOrUpdateChild("poptip-content",B,"text");i.isEmpty(u?.content)||(w.states=u.content);const M=w.AABBBounds,L=M.height(),T=M.width();k&&(E+=L);let C=i.max(S+g[1]+g[3],T+g[1]+g[3]);C>d?C=d:C<l&&(C=l);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),D=H.lineWidth??1,R=this.stage?[this.stage.width,this.stage.height]:void 0,O="auto"===s;let N,$=1/0;for(let t=0;t<this.positionList.length+1;t++){const e=O?this.positionList[t===this.positionList.length?N:t]:s,{angle:a,offset:n,rectOffset:r}=this.getAngleAndOffset(e,C,P,i.isArray(V)?V:[V,V-D]);if(i.isBoolean(I)){const t=(i.isArray(z)?z[0]:z)/4,e=_.createOrUpdateChild("poptip-symbol-panel",{...H,visible:I&&(k||y),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||y),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}),!O||!R)break;{const e=this.AABBBounds,s=(new i.Bounds).setValue(0,0,R[0],R[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,N=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 B="inversify:paramtypes";function w(t){return w="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},w(t)}var M=0;var L=function(t){this.id=M++,this.registry=t};function T(){return function(t){if(Reflect.hasOwnMetadata(B,t))throw new Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(B,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":w(Reflect))&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(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,o,l,d,h,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}),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}));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 D=new L((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 R extends n{name="crosshair";render(){this.renderCrosshair(this)}}class O extends R{static defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};constructor(t){super(i.merge({},O.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 N extends R{static defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};topLabelShape;bottomLabelShape;leftLabelShape;rightLabelShape;constructor(t){super(i.merge({},N.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 R{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 R{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=m,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})}}class F extends R{static defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};constructor(t){super(i.merge({},F.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:s,sides:a=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:o}=this.attribute,l=(o-r)%(2*Math.PI)==0,d=(o-r)/a;let h;for(let t=0;t<=a;t++){const n=r+d*t,o=i.polarToCartesian(e,s,n);0===t?h=`M${o.x},${o.y}`:h+=`L${o.x},${o.y}`,t===a&&l&&(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)}}const G=5,W=31,X=32,Y=new Uint32Array(X+1),Z=new Uint32Array(X+1);Z[0]=0,Y[0]=~Z[0];for(let t=1;t<=X;++t)Z[t]=Z[t-1]<<1|1,Y[t]=~Z[t];function j(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+X)/X));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>>>G]&1<<(a&W)},set:(e,i)=>{const a=i*t+e;s(a>>>G,1<<(a&W))},clear:(e,i)=>{const s=i*t+e;a(s>>>G,~(1<<(s&W)))},getRange:({x1:s,y1:a,x2:n,y2:r})=>{if(n<0||r<0||s>t||a>e)return!0;let o,l,d,h,c=r;for(;c>=a;--c)if(o=c*t+s,l=c*t+n,d=o>>>G,h=l>>>G,d===h){if(i[d]&Y[o&W]&Z[1+(l&W)])return!0}else{if(i[d]&Y[o&W])return!0;if(i[h]&Z[1+(l&W)])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 o,l,d,h,c;for(;a<=r;++a)if(o=a*t+i,l=a*t+n,d=o>>>G,h=l>>>G,d===h)s(d,Y[o&W]&Z[1+(l&W)]);else for(s(d,Y[o&W]),s(h,Z[1+(l&W)]),c=d+1;c<h;++c)s(c,4294967295)},clearRange:({x1:e,y1:i,x2:s,y2:n})=>{let r,o,l,d,h;for(;i<=n;++i)if(r=i*t+e,o=i*t+s,l=r>>>G,d=o>>>G,l===d)a(l,Z[r&W]|Y[1+(o&W)]);else for(a(l,Z[r&W]),a(d,Y[1+(o&W)]),h=l+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,o=i[a>>>G]&1<<(a&W);n[r+0]=255*o,n[r+1]=255*o,n[r+2]=255*o,n[r+3]=31}return a}}}(a,n),r.ratio=s,r.padding=i,r.width=t,r.height=e,r}function q(t,e,s=!1){if(s){const{x1:s,x2:a,y1:n,y2:r}=e,o=i.clamp(s,0,t.width),l=i.clamp(a,0,t.width),d=i.clamp(n,0,t.height),h=i.clamp(r,0,t.height);return{x1:t(o),x2:t(l),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=q(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,q(t,r.AABBBounds),a))return e.setRange(q(t,r.AABBBounds,!0)),s[n]}return!1}function tt(t,e,s,a,n,r,o){if("bound"===s.type||"position"===s.type){if(i.isFunction(o)){const l=((i.isFunction(s.position)?s.position(n.attribute):s.position)||function(t){if("rect"===t)return it;return et}(a.type)).map((t=>o(n.AABBBounds,r,t,a.offset)));return Q(t,e,n,l,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,o=Math.min(s,a),l=Math.max(s,a),d=Math.min(n,r),h=Math.max(n,r);let c=0,u=0;return o<0&&l-o<=e?c=-o:l>e&&o-(l-e)>=0&&(c=e-l),d<0&&h-d<=i?u=-d:h>i&&d-(h-i)>=0&&(u=i-h),{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",ot=300,lt="linear";class dt extends n{name="label";_baseMarks;_bitmap;setBitmap(t){this._bitmap=t}_bmpTool;setBitmapTool(t){this._bmpTool=t}_graphicToText;_idToGraphic;onAfterLabelOverlap;_lastHover;_lastSelect;_enableAnimation;render(){this._prepare();const{overlap:t,smartInvert:e,dataFilter:s,customLayoutFunc:a,customOverlapFunc:n}=this.attribute;let r,o=this.attribute.data;i.isFunction(s)&&(o=s(o)),i.isFunction(a)?r=a(o,(t=>this._idToGraphic.get(t.id))):(r=this.layout(o),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),o(this,(t=>{t===e||i.isEmpty(t.states)||t.addState(f.hoverReverse,!0)})),this._lastHover=e)};_onUnHover=t=>{this._lastHover&&(o(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 o(this,(t=>{i.isEmpty(t.states)||(t.removeState(f.selectedReverse),t.removeState(f.selected))}));i.isEmpty(e.states)||(e.addState(f.selected,!0),o(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=this.getBaseMarks(),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=[];for(let r=0;r<t.length;r++){const o=t[r],l=this._idToGraphic.get(o.id),d={...e,...o},h=this._createLabelText(d),c=this.getGraphicBounds(h),u=this.getGraphicBounds(l,{x:o.x,y:o.y}),p=this.labeling(c,u,i.isFunction(s)?s(o):s,a);p&&(d.x=p.x,d.y=p.y,h.setAttributes(p),n.push(h))}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:o=[],hideOnHit:l=!0,clampForce:d=!0}=e,h=this._bmpTool||j(n.width,n.height),c=this._bitmap||h.bitmap(),u=o.some((t=>"bound"===t.type));r&&this._baseMarks?.forEach((t=>{t.AABBBounds&&c.setRange(q(h,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(h,c,i.AABBBounds,d)){if(!u){c.setRange(q(h,i.AABBBounds,!0)),s.push(i);continue}if(u&&a?.AABBBounds&&K(i.AABBBounds,a?.AABBBounds)){c.setRange(q(h,i.AABBBounds,!0)),s.push(i);continue}}let n=!1;for(let r=0;r<o.length;r++)if(n=tt(h,c,o[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(d){const{dx:t=0,dy:e=0}=st(i,h.width,h.height);if((0!==t||0!==e)&&J(h,c,{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}),c.setRange(q(h,i.AABBBounds,!0)),s.push(i);continue}}!n&&!l&&s.push(i)}return i.isFunction(this.onAfterLabelOverlap)&&this.onAfterLabelOverlap(c),s}getBaseMarks(){const t=this.getBaseMarkGroup();if(t)return t.getChildren()}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??ot,o=s.easing??lt,l=s.delay??0,d=new Map,h=this._graphicToText||new Map,c=[];t.forEach(((t,u)=>{const p=this._idToGraphic.get(t.attribute.id),b=h?.get(p)?"update":"enter";if("enter"===b)if(c.push(t),d.set(p,t),!a&&p){const{from:e,to:i}=nt(t.attribute,"fadeIn");this.add(t),p.onAnimateBind=()=>{t.setAttributes(e);const s=this._afterRelatedGraphicAttributeUpdate(t,c,u,p,{mode:n,duration:r,easing:o,to:i,delay:l});p.on("afterAttributeUpdate",s)}}else this.add(t);if("update"===b){const n=h.get(p);h.delete(p),d.set(p,n),a?n.setAttributes(t.attribute):(n.animate().to(t.attribute,r,o),!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,o)))}})),h.forEach((t=>{a?this.removeChild(t):t?.animate().to(nt(t.attribute,"fadeOut").to,r,o).onEnd((()=>{this.removeChild(t)}))})),this._graphicToText=d}_afterRelatedGraphicAttributeUpdate(t,i,s,a,{mode:n,duration:r,easing:o,to:l,delay:d}){const h=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(l);const p=()=>{a&&(a.onAnimateBind=void 0,a.removeEventListener("afterAttributeUpdate",h))};switch(n){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(d).to(l,r,o);break;case"after-all":s===i.length-1&&u.animationState.end&&i.forEach((t=>{t.animate({onEnd:p}).wait(d).to(l,r,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(d).to(l,r,o)}};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),o=K(n.AABBBounds,r?.AABBBounds);if(n.attribute.stroke&&n.attribute.lineWidth>0)n.setAttributes({fill:h(n.attribute.fill,n.attribute.stroke,i,s,a)});else if(o){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{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({},ht.defaultAttributes,t))}labeling(t,e,i="top",s=0){if(!t)return;const{x1:a,y1:n,x2:r,y2:o}=t,l=Math.abs(r-a),d=Math.abs(o-n),h=(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:h+u*(s+b)+Math.sign(u)*(l/2),y:c+p*(s+g)+Math.sign(p)*(d/2)}}}class ct extends dt{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:o}=t,l=Math.abs(r-a),d=Math.abs(o-n),h=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*h,p+=g*c;let _=0,m=0;const y=i.includes("inside");i.includes("top")?m=y?1:-1:i.includes("bottom")?m=y?-1:1:i.includes("left")?_=y?1:-1:i.includes("right")&&(_=y?-1:1);return{x:u+_*s+_*l/2,y:p+m*s+m*d/2}}}class ut extends dt{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),o=e.x1;let l=o;return"end"===i?l=o+r/2+s:"start"===i&&(l=o-r/2-s),{x:l,y:e.y1}}}const pt={rect:ct,symbol:ht};class bt extends n{name="data-label";_componentMap;static defaultAttributes={pickable:!1};constructor(t){super(i.merge({},bt.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=j(s,a),r=n.bitmap(),o=new Map,l=this._componentMap;for(let e=0;e<t.length;e++){const i=t[e];if(pt[i.type]){const{baseMarkGroupName:t}=i;let e=this._componentMap.get(t);e?(e.setBitmapTool(n),e.setBitmap(r),e.setAttributes(i),o.set(t,e)):(e=new pt[i.type](i),e.setBitmap(r),e.setBitmapTool(n),this.add(e),o.set(t,e))}}l.forEach(((t,e)=>{o.get(e)||this.removeChild(t)})),this._componentMap=o}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function gt(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function _t(t,e,s,a){let n="";if(!t||0===e.length)return n;const r=e[0],o=i.PointService.distancePP(t,r),l=s?0:1;return a?n+=`M${t.x},${t.y-o}A${o},${o},0,0,${l},${t.x},${t.y+o}A${o},${o},0,0,${l},${t.x},${t.y-o}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${o},${o},0,0,${l},${t.x},${t.y}`})),n}function mt(t,e,s){const{type:a,closed:n}=s,r=e.slice(0).reverse();let o="",l="";if("line"===a&&s.smoothLink&&s.center){const e=t[0],a=r[0],d=s.center;o=gt(t,!!n),l=gt(r,!!n);const h=i.PointService.distancePP(a,d),c=i.PointService.distancePP(e,d);o+=`A${h},${h},0,0,1,${a.x},${a.y}L${a.x},${a.y}`,l+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===a){const{center:e}=s;o=_t(e,t,!1,!!n),l=_t(e,r,!0,!!n)}else"line"!==a&&"polygon"!==a||(o=gt(t,!!n),l=gt(r,!!n));return n?o+=l:(l="L"+l.substring(1),o+=l,o+="Z"),o}class yt extends n{name="grid";static defaultAttributes={style:{lineWidth:1,stroke:"#416180"},zIndex:0};constructor(t){super(i.merge({},yt.defaultAttributes,t))}render(){this.removeAllChild();const{type:t,items:s,style:a,closed:n,alternateColor:r,depth:o=0}=this.attribute;if(!i.isEmpty(s)&&(s.forEach(((s,r)=>{const{id:l,points:d}=s;let h="";if("line"===t||"polygon"===t)h=gt(d,!!n);else if("circle"===t){const{center:t}=this.attribute;h=_t(t,d,!1,!!n)}const c=e.createPath({path:h,z:o,...i.isFunction(a)?i.merge({},yt.defaultAttributes.style,a(s,r)):a});c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${l}`),this.add(c)})),o&&"line"===t&&s.forEach(((t,s)=>{const{id:r,points:l}=t,d=[];d.push(l[0]);const h=l[1].x-l[0].x,c=l[1].y-l[0].y,u=Math.sqrt(h*h+c*c),p=o/u;d.push({x:l[0].x+h*p,y:l[0].y+c*p});const b=gt(d,!!n),g=i.abs(d[0].x-d[1].x),_=i.abs(d[0].y-d[1].y),m=e.createPath({path:b,z:0,alpha:g>_?(l[1].x-l[0].x>0?-1:1)*i.pi/2:0,beta:g<_?-i.pi/2:0,anchor3d:g>_?[d[0].x,0]:[0,d[0].y],...i.isFunction(a)?i.merge({},yt.defaultAttributes.style,a(t,s)):a});m.name=`${this.name}-line`,m.id=this._getNodeId(`path-${r}`),this.add(m)})),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=mt(i,n,this.attribute),o=e.createPath({path:r,fill:a(t)});o.name=`${this.name}-region`,o.id=this._getNodeId(`region-${t}`),this.add(o)}}}_getNodeId(t){return`${this.id}-${t}`}}class xt 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({},xt.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]),o=[a.x-s.x,a.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=r,this._endAngle=l}render(){this.removeAllChild();const{points:t,startSymbol:s,endSymbol:a,lineStyle:n,state:r,visible:o=!0}=this.attribute;if(!o)return;t.length>1&&this.computeLineAngle();const l=this.renderSymbol(s,"start"),d=this.renderSymbol(a,"end");this.startSymbol=l,this.endSymbol=d;let h=t;if(s?.visible){const e=s?.clip?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(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)};h=[...h.slice(0,h.length-1),i]}const c=e.createLine({points:h,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,o=this._endAngle,{points:l,state:d}=this.attribute,h=l[0],c=l[l.length-1],{refX:u=0,refY:p=0,refAngle:b=0,style:g,symbolType:_,size:m=12}=t;let y,x;"start"===s?(y={x:h.x+(r?u*Math.cos(r)+p*Math.cos(r-Math.PI/2):0),y:h.y+(r?u*Math.sin(r)+p*Math.sin(r-Math.PI/2):0)},x=r+Math.PI/2):(y={x:c.x+(o?u*Math.cos(o)+p*Math.cos(o-Math.PI/2):0),y:c.y+(o?u*Math.sin(o)+p*Math.sin(o-Math.PI/2):0)},x=o+Math.PI/2),n=e.createSymbol({...y,symbolType:_,size:m,angle:a?x+b:0,strokeBoundsBuffer:0,...g}),n.name=`${s}-symbol`,n.id=this._getNodeId(`${s}-symbol`),i.isEmpty(d?.symbol)||(n.states=d.symbol),this.add(n)}return n}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var ft,vt;t.AXIS_ELEMENT_NAME=void 0,(ft=t.AXIS_ELEMENT_NAME||(t.AXIS_ELEMENT_NAME={})).innerView="inner-view",ft.axisContainer="axis-container",ft.labelContainer="axis-label-container",ft.tickContainer="axis-tick-container",ft.tick="axis-tick",ft.subTick="axis-sub-tick",ft.label="axis-label",ft.title="axis-title",ft.gridContainer="axis-grid-container",ft.grid="axis-grid",ft.gridRegion="axis-grid-region",ft.line="axis-line",ft.background="axis-background",t.AxisStateValue=void 0,(vt=t.AxisStateValue||(t.AxisStateValue={})).selected="selected",vt.selectedReverse="selected_reverse",vt.hover="hover",vt.hoverReverse="hover_reverse";const At={[t.AxisStateValue.selectedReverse]:{},[t.AxisStateValue.selected]:{},[t.AxisStateValue.hover]:{},[t.AxisStateValue.hoverReverse]:{}},St={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 Et 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),o(this.axisContainer,(t=>{t!==e&&t.name&&!i.isEmpty(t.states)&&t.addState(f.hoverReverse,!0)})),this._lastHover=e)};_onUnHover=t=>{this._lastHover&&(o(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 o(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),o(this.axisContainer,(t=>{t!==e&&t.name&&!i.isEmpty(t.states)&&t.addState(f.selectedReverse,!0)})),this._lastSelect=e)};_renderInner(s){const{title:a,label:n,tick:r,line:o,grid:l,items:d,panel:h}=this.attribute,c=e.createGroup({x:0,y:0,zIndex:1});if(c.name=t.AXIS_ELEMENT_NAME.axisContainer,c.id=this._getNodeId("container"),c.setMode(this.mode),this.axisContainer=c,s.add(c),o?.visible&&this.renderLine(c),d&&d.length){if(this.data=this._transformItems(d[0]),r?.visible&&this.renderTicks(c),n?.visible){const i=e.createGroup({x:0,y:0,pickable:!1});i.name=t.AXIS_ELEMENT_NAME.labelContainer,i.id=this._getNodeId("label-container"),this.axisLabelsContainer=i,c.add(i),d.forEach(((t,e)=>{const s=this.renderLabels(i,t,e).getChildren();this.handleLabelsOverlap(s,t,e,d.length)}))}l?.visible&&this.renderGrid(s)}if(a?.visible&&this.renderTitle(c),h&&h.visible){const s=c.AABBBounds,a=e.createRect({x:s.x1,y:s.y1,width:s.width(),height:s.height(),...h.style});a.name=t.AXIS_ELEMENT_NAME.background,a.id=this._getNodeId("background"),i.isEmpty(h.state)||(a.states=i.merge({},v,h.state)),c.insertBefore(a,c.firstChild)}}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 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(this.attribute.tick?.state))o.states=null;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))})),o.states=e}n.add(o)})),this.tickLineItems=a;const{subTick:r}=this.attribute;if(r?.visible){const s=this.getSubTickLineItems();s.length&&s.forEach(((s,o)=>{const l=e.createLine({...this._getTickLineAttribute("subTick",s,o,a)});if(l.name=t.AXIS_ELEMENT_NAME.subTick,l.id=this._getNodeId(`${o}`),i.isEmpty(r.state))l.states=null;else{const t=i.merge({},v,r.state);Object.keys(t).forEach((e=>{i.isFunction(t[e])&&(t[e]=t[e](s.value,o,s,a))})),l.states=t}n.add(l)})),this.subTickLineItems=s}}renderLabels(s,a,n){const{dataFilter:r}=this.attribute.label;r&&i.isFunction(r)&&(a=r(a,n));const o=this._transformItems(a),l=e.createGroup({x:0,y:0,pickable:!1});l.name=`${t.AXIS_ELEMENT_NAME.labelContainer}-layer-${n}`,l.id=this._getNodeId(`label-container-layer-${n}`),s.add(l);let d=0,h=0,c="center",u="middle";return o.forEach(((s,a)=>{const r=this._getLabelAttribute(s,a,o,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=null;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,o,n))})),p.states=t}l.add(p);const b=r.angle??0;d=Math.max(d,p.AABBBounds.width()),h=Math.max(h,p.AABBBounds.height()),b&&(d=Math.abs(d*Math.cos(b)),h=Math.abs(h*Math.sin(b))),c=r.textAlign,u=r.textBaseline})),this.axisLabelLayerSize[n]={width:d,height:h,textAlign:c,textBaseline:u},l}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:o}=t;let l=1;return e.length>=2&&(l=e[1].value-e[0].value),(o&&i.isFunction(o)?o(e):e).forEach((t=>{let e=t.point,o=t.value;if(!a){const i=t.value-l/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),o=i}const d=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const a=this.getVerticalVector(r,n,e);let l=0,h=0;i.abs(a[0])>i.abs(a[1])?l=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:o,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:l,beta:h})}else s.push({start:e,end:d,value:o,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],o=n[t+1];for(let t=0;t<i;t++){const n=(t+1)/(i+1),l=(1-n)*r.value+n*o.value,d=this.getTickCoord(l),h=this.getVerticalCoord(d,a,s);e.push({start:d,end:h,value:l,id:`sub-tick-${l}`})}}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(St,`${t}.style`),"tick"===t?n(r.rawValue,s,r,this.data):n(e.value,s,e,a)):n;const{start:o,end:l,anchor:d,alpha:h,beta:c}=e;return{points:[o,l],anchor:d,alpha:h,beta:c,...n}}_getLabelAttribute(t,e,s,a){const{space:n=4,inside:r=!1,formatMethod:o,...l}=this.attribute.label;let d=n,h=0;this.attribute.tick?.visible&&this.attribute.tick?.inside===r&&(h=this.attribute.tick?.length||4),this.attribute.subTick?.visible&&this.attribute.subTick?.inside===r&&(h=Math.max(h,this.attribute.subTick?.length||2)),d+=h;const c=this.getRelativeVector(t.point);a>0&&(0===c[1]?d+=(this.axisLabelLayerSize[a-1].height+i.get(this.attribute,"label.space",4))*a:d+=(this.axisLabelLayerSize[a-1].width+i.get(this.attribute,"label.space",4))*a);const u=this.getVerticalCoord(t.point,d,r),p=this.getVerticalVector(d,r,u),b=o?o(`${t.label}`,t,e,s,a):t.label;let{style:g}=l;return g=i.isFunction(g)?i.merge({},St.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 yt({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 kt={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&Bt(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Bt(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function wt(t,e){for(let i,s=1,a=t.length,n=t[0].AABBBounds;s<a;n=i,++s)if(Bt(n,i=t[s].AABBBounds,e))return!0}function Mt(t){const e=t.AABBBounds;return e.width()>1&&e.height()>1}function Lt(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 Tt(t,e){"bottom"!==t&&"top"!==t||function(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})}))}(t,e),"left"!==t&&"right"!==t||function(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})}))}(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,o=t.attribute.y,{x:(s-r)*Math.cos(n)+(a-o)*Math.sin(n)+r,y:(s-r)*Math.sin(n)+(o-a)*Math.cos(n)+o});var s,a,n,r,o;const l=i.x-e.centerX,d=i.y-e.centerY;e.x1+=l,e.x2+=l,e.y1+=d,e.y2+=d,e.centerX+=l,e.centerY+=d,t.rotatedBounds=e}))}(e)}class Ct extends Et{static defaultAttributes=St;constructor(t,e){super(i.merge({},Ct.defaultAttributes,t),e),"3d"===e&&this.setMode(e)}renderLine(e){const{start:s,end:a,line:n}=this.attribute,{startSymbol:r,endSymbol:o,style:l,breakRange:d,breakShape:h,breakShapeStyle:c,state:u,...p}=n,b={points:[s,a],startSymbol:r,endSymbol:o,lineStyle:l,...p};i.isEmpty(u)||(b.state={line:i.merge({},At,u),symbol:i.merge({},At,u)});const g=new xt(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:o,...l}=this.attribute.title;let d=.5;"start"===t?d=0:"end"===t&&(d=1);const{verticalFactor:h=1}=this.attribute,c=-1*h,u=this.getTickCoord(d),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 m=g+b+e,y=this.getVerticalCoord(u,m,!1),x=this.getVerticalVector(m,!1);let f,v,{angle:A}=l;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={...y,...l,textStyle:{textAlign:f,textBaseline:v,...s},state:i.isEmpty(o)?null:{text:o.text,shape:o.shape,panel:o.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=m,endAngle:r=y}=this.attribute.grid;s=function(t,e,s,a,n){const r=[],o=n-a;for(let n=0;n<e;n++){const l=a+n*o/e;r.push(i.polarToCartesian(t,s,l))}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:o=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<o;i++){const r=(i+1)/(o+1),l=(1-r)*a.value+r*n.value,d=this.getTickCoord(l);t.push({id:`sub-${s}-${i+1}`,points:this._getGridPoint(e,d),datum:{}})}s===i.length-2&&t.push({id:`sub-${s}-${o+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}handleLabelsOverlap(t,e,s,a){if(i.isEmpty(t))return;const{verticalLimitSize:n,label:r,title:o,line:l,tick:d,orient:h}=this.attribute,c=r.space??4;let u=n,p=0,b=0;const g=l?.visible?l.style.lineWidth??1:0,_=d?.visible?d.length??4:0;o?.visible&&(p=S(o.text,o.textStyle).height,b=o.space),u&&(u=(u-c-b-p-g-_)/a);const{layoutFunc:m,autoRotate:y,autoRotateAngle:x,autoLimit:f,limitEllipsis:v,autoHide:A,autoHideMethod:E,autoHideSeparation:k}=r;i.isFunction(m)?m(t,e,s,this):(y&&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)})),Tt(s,t),!Lt(t))break}}(t,{labelRotateAngle:x,orient:h}),f&&i.isValidNumber(u)&&u>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:u,ellipsis:v,orient:h}),A&&function(t,e){if(i.isEmpty(t))return;const s=t.filter(Mt);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,o=i.isFunction(n)?n:kt[n]||kt.parity;if(a.length>=3&&wt(a,r)){do{a=o(a,r)}while(a.length>=3&&wt(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:h,method:E,separation:k}))}}class Pt extends Et{static defaultAttributes=St;constructor(t){super(i.merge({},Pt.defaultAttributes,t))}renderLine(s){const{startAngle:a=m,endAngle:n=y,radius:r,center:o,innerRadius:l=0,line:d,inside:h=!1}=this.attribute;let c=r,u=l;h&&l>0&&(c=l,u=0);const p={...o,startAngle:a,endAngle:n,radius:c,innerRadius:u,...d?.style},b=e.createCircle(p);b.name=t.AXIS_ELEMENT_NAME.line,b.id=this._getNodeId("line"),i.isEmpty(d?.state)||(b.states=i.merge({},At,d.state)),s.add(b)}isInValidValue(t){const{startAngle:e=m,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=m,endAngle:s=y,center:a,radius:n,inside:r=!1,innerRadius:o=0}=this.attribute,l=e+(s-e)*t;return i.polarToCartesian(a,r&&o>0?o:n,l)}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:o,state:l,...d}=this.attribute.title;let h=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",h={x:t.x,y:t.y-p}):"end"===g&&(b="top",h={x:t.x,y:t.y+p});const _={...h,...d,textStyle:{textBaseline:b,textAlign:"center",...n},state:i.isEmpty(l)?null:{text:l.text,shape:l.shape,panel:l.background}},{angle:m}=d;return _.angle=m,r&&r.visible&&(_.shape={visible:!0,...r.style},r.space&&(_.space=r.space)),o&&o.visible&&(_.panel={visible:!0,...o.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,o=this.attribute?.tick?.alignWithLabel;for(let l=0;l<r;l++){const r=n[l],d=n[l+1];for(let n=0;n<i;n++){const l=(n+1)/(i+1),h=(1-l)*r.value+l*(d?d.value:o?1:r.value+t),c=this.getTickCoord(h),u=this.getVerticalCoord(c,a,s);e.push({start:c,end:u,value:h})}}}return e}getGridAttribute(t){let e,s=[];const{radius:a,innerRadius:n=0,startAngle:r=m,endAngle:o=y,center:l,grid:d}=this.attribute,{alignWithLabel:h=!0}=d||{},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(o-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-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(!h){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),o=(1-r)*s.value+r*(n?n.value:h?1:s.value+u),l=this.getTickCoord(o),d=this.getVerticalCoord(l,c,!0);t.push({id:`sub-${i}-${e+1}`,points:[l,d],datum:{}})}}Math.abs(o-r)%(2*Math.PI)==0&&t.push(t[0]),s=t}}return{...e,items:s,center:l}}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}handleLabelsOverlap(t,e,i,s){}}class It 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 o(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},o(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 Ht 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 zt 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 Vt;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(Vt||(Vt={}));const Dt={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 Rt extends n{name="dataZoom";static defaultAttributes=Dt;_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({},Rt.defaultAttributes,t));const{start:e,end:s,size:a,orient:n,showDetail:r,position:o,previewData:l,previewCallbackX:d,previewCallbackY:h,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=o,this._activeCache.lastPos=o,this._showText="auto"!==r&&r,l&&(this._previewData=l),i.isFunction(d)&&(this._previewCallbackX=d),i.isFunction(h)&&(this._previewCallbackY=h),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=Vt.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=Vt.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=Vt.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=Vt.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=Vt.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,o=(a[n]-this._activeCache.lastPos[n])/r;this._activeState&&(this._activeTag===Vt.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===Vt.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=Vt.endHandler):this.state.start=this.state.start+o:this._activeTag===Vt.endHandler&&(this.state.end+o<this.state.start?(this.state.end=this.state.start,this.state.start=this.state.end+o,this._activeTag=Vt.startHandler):this.state.end=this.state.end+o),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===Vt.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],o=Math.min(Math.max(Math.min(n,r)/s,0),1),l=Math.min(Math.max(Math.max(n,r)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}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===Vt.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===Vt.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:o,end:l}=this.state;this._startValue=this._statePointToData(o),this._endValue=this._statePointToData(l);const{position:d,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,i.merge({},a,{text:s?s(this._startValue):this._startValue,x:d.x+o*h,y:d.y+c/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+l*h,y:d.y+c/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+o*c,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+l*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${d}`))}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:o}=e,l=s?.background?.size??10;let d,h,c;s?.visible?this._isHorizontal?(d=r,h=o-l,c={x:t.x,y:t.y+l}):(d=r-l,h=o,c={x:t.x+("left"===i?l:0),y:t.y}):(d=r,h=o,c=t);const u=a?.size??(this._isHorizontal?h:d),p=n?.size??(this._isHorizontal?h:d);return a?.visible&&(this._isHorizontal?(d-=(u+p)/2,c={x:c.x+u/2,y:c.y}):(h-=(u+p)/2,c={x:c.x,y:c.y+u})),this._layoutAttrFromConfig={position:c,width:d,height:h},this._layoutAttrFromConfig}render(){this._layoutAttrFromConfig=null;const{orient:t,backgroundStyle:e,backgroundChartStyle:i,selectedBackgroundStyle:s,selectedBackgroundChartStyle:a,middleHandlerStyle:n,startHandlerStyle:r,endHandlerStyle:o,brushSelect:l}=this.attribute,{start:d,end:h}=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:l?"crosshair":"auto",...e},"rect"),i?.line?.visible&&this.setPreviewAttributes("line",b),i?.area?.visible&&this.setPreviewAttributes("area",b),l&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=b.createOrUpdateChild("selectedBackground",{x:c.x+d*u,y:c.y,width:(h-d)*u,height:p,cursor:l?"crosshair":"move",...s},"rect"):this._selectedBackground=b.createOrUpdateChild("selectedBackground",{x:c.x,y:c.y+d*p,width:u,height:(h-d)*p,cursor:l?"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+d*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+h*u,y:c.y+p/2,size:p,angle:0,symbolType:o?.symbolType??"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",...o},"symbol"),n?.visible&&(this._middleHandlerRect=b.createOrUpdateChild("middleHandlerRect",{x:c.x+d*u,y:c.y-(n?.background?.size||10),width:(h-d)*u,height:n?.background?.size||10,...n?.background?.style},"rect"),this._middleHandlerSymbol=b.createOrUpdateChild("middleHandlerSymbol",{x:c.x+(d+h)/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+d*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+d*p,width:n?.background?.size||10,height:(h-d)*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+(d+h)/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+h*p,size:u,angle:Math.PI/180*90,symbolType:o?.symbolType??"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0,...o},"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:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+s*r:n.x,y:this._isHorizontal?n.y:n.y+s*o,width:this._isHorizontal?(a-s)*r:r,height:this._isHorizontal?o:(a-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+s*r:n.x),y:-(this._isHorizontal?n.y:n.y+s*o),width:this._isHorizontal?(a-s)*r:r,height:this._isHorizontal?o:(a-s)*o,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 Ot,Nt,$t;t.IMarkLineLabelPosition=void 0,(Ot=t.IMarkLineLabelPosition||(t.IMarkLineLabelPosition={})).start="start",Ot.middle="middle",Ot.end="end",Ot.insideStartTop="insideStartTop",Ot.insideStartBottom="insideStartBottom",Ot.insideMiddleTop="insideMiddleTop",Ot.insideMiddleBottom="insideMiddleBottom",Ot.insideEndTop="insideEndTop",Ot.insideEndBottom="insideEndBottom",t.IMarkAreaLabelPosition=void 0,(Nt=t.IMarkAreaLabelPosition||(t.IMarkAreaLabelPosition={})).left="left",Nt.right="right",Nt.top="top",Nt.bottom="bottom",Nt.middle="middle",Nt.insideLeft="insideLeft",Nt.insideRight="insideRight",Nt.insideTop="insideTop",Nt.insideBottom="insideBottom",t.IMarkPointItemPosition=void 0,($t=t.IMarkPointItemPosition||(t.IMarkPointItemPosition={})).top="top",$t.bottom="bottom",$t.middle="middle",$t.insideTop="insideTop",$t.insideBottom="insideBottom",$t.insideMiddle="insideMiddle";class Ut 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.updateMarker();else{const t=e.createGroup({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const Ft={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]}},Gt={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"}},Wt={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}},Xt={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"}},Yt={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}}},Zt={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 jt extends Ut{static defaultAttributes=Ft;_line;constructor(t){super(i.merge({},jt.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:{...Gt[i],...e.textStyle}})}initMarker(t){const{points:e,startSymbol:i,endSymbol:s,label:a,lineStyle:n}=this.attribute,r=new xt({points:e,startSymbol:i,endSymbol:s,lineStyle:n});r.name="mark-line-line",this._line=r,t.add(r);const o=new E({...a});o.name="mark-line-label",this._label=o,t.add(o),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 qt extends Ut{static defaultAttributes=Wt;_area;constructor(t){super(i.merge({},qt.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:{...Xt[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 Jt extends Ut{static defaultAttributes=Yt;_item;_line;_decorativeLine;constructor(t){super(i.merge({},Jt.defaultAttributes,t))}setLabelPos(){}setItemAttributes(e,i,s,a){const{autoRotate:n=!0,refX:r=0,refY:o=0,refAngle:l=0,textStyle:d,richTextStyle:h,imageStyle:c,position:u=t.IMarkPointItemPosition.middle}=i,p=this._line?.getEndAngle()||0,b=r*Math.cos(p)+o*Math.cos(p-Math.PI/2),g=r*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===a?e?.setAttributes({...d,textStyle:{...Zt[i?.position||"end"],...d?.textStyle}}):"richText"===a?e?.setAttributes({dx:this.getItemDx(e,u,h)+(h?.dx||0),dy:this.getItemDy(e,u,h)+(h?.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+l})}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:o}=t;let l;return"symbol"===s?l=e.createSymbol({...i,...a}):"text"===s?l=new E({...i}):"richText"===s?l=e.createRichText({...i,...n}):"image"===s?l=e.createImage({...i,...r}):"custom"===s&&o&&(l=o()),this.setItemAttributes(l,t,i,s),l}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,o=this.getItemLineAttr(t,e,i);this._line?.setAttributes({points:o,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:o}=this.getDecorativeLineAttr(t,e);this._decorativeLine?.setAttributes({points:[{x:e.x+a,y:e.y+n},{x:e.x+r,y:e.y+o}],...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 xt({points:[]});r.name="mark-point-line",this._line=r,t.add(r);const o=e.createLine({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(s,i,n,s?.visible),this.setDecorativeLineAttr(s,n,s?.decorativeLine?.visible);const l=this.initItem(a,n);this._item=l,t.add(l)}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 Kt={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class Qt extends n{name="pager";_current=1;getCurrent(){return this._current}_total;preHandler;nextHandler;text;static defaultAttributes={handler:Kt,textStyle:{fill:"rgb(51, 51, 51)",fontSize:12}};constructor(t){super(i.merge({},Qt.defaultAttributes,t))}render(){this._reset();const{layout:t="horizontal",handler:s=Kt,total:a,defaultCurrent:n=1,textStyle:r,padding:o=0}=this.attribute;this._current=n;const l=i.normalizePadding(o),d="horizontal"===t,h=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=d?"triangleLeft":"triangleUp"),_||(_=d?"triangleRight":"triangleDown");const m=e.createSymbol({strokeBoundsBuffer:0,pickMode:"imprecise",...c,x:0,y:0,symbolType:g,size:u});m.states=b,m.name="preHandler",this.preHandler=m,h.add(m);const{width:y,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:d?f/2+p+y/2:0,y:d?0:v/2+p+x/2,text:`${n}/${a}`,textAlign:"center",textBaseline:"middle",lineHeight:r?.fontSize,...r});this.text=A,h.add(A);const E=e.createSymbol({strokeBoundsBuffer:0,pickMode:"imprecise",...c,x:d?f+2*p+y:0,y:d?0:v+2*p+x,symbolType:_,size:u});E.name="nextHandler",E.states=b,this.nextHandler=E,h.add(E),1===this._total?(m.addState("disable"),E.addState("disable")):1===this._current?m.addState("disable"):this._current===a&&E.addState("disable");const k=h.AABBBounds,B=k.width(),w=k.height();h.translateTo(0-k.x1+l[3],0-k.y1+l[0]),this.add(h),this.attribute.width=B+l[1]+l[3],this.attribute.height=w+l[0]+l[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 te=16,ee=8,ie=12,se=12;var ae,ne,re;t.LegendStateValue=void 0,(ae=t.LegendStateValue||(t.LegendStateValue={})).selected="selected",ae.unSelected="unSelected",ae.selectedHover="selectedHover",ae.unSelectedHover="unSelectedHover",ae.focus="focus",t.LegendEvent=void 0,(ne=t.LegendEvent||(t.LegendEvent={})).legendItemHover="legendItemHover",ne.legendItemUnHover="legendItemUnHover",ne.legendItemClick="legendItemClick",t.LEGEND_ELEMENT_NAME=void 0,(re=t.LEGEND_ELEMENT_NAME||(t.LEGEND_ELEMENT_NAME={})).innerView="innerView",re.title="legendTitle",re.item="legendItem",re.itemShape="legendItemShape",re.itemLabel="legendItemLabel",re.itemValue="legendItemValue",re.focus="legendItemFocus";class oe 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),o=e.createGroup({x:r[3],y:r[0],pickable:s,childrenPickable:s});o.name=t.LEGEND_ELEMENT_NAME.innerView,this.add(o),this._innerView=o,a?.visible&&this._renderTitle(a),this._renderContent(),this._adjustLayout(),s&&this._bindEvents();const l=this._innerView.AABBBounds;this.attribute.width=l.width()+r[1]+r[3],this.attribute.height=l.height()+r[0]+r[2]}_renderTitle(e){const{text:s="",textStyle:a,padding:n=0,background:r,minWidth:o,maxWidth:l,shape:d}=e,h={x:0,y:0,text:s,textStyle:a,padding:i.normalizePadding(n),minWidth:o,maxWidth:l};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 c=new E(h);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 le={[t.LegendStateValue.focus]:{},[t.LegendStateValue.selected]:{},[t.LegendStateValue.selectedHover]:{},[t.LegendStateValue.unSelected]:{},[t.LegendStateValue.unSelectedHover]:{}};class de extends oe{name="discreteLegend";_itemsContainer=null;_itemWidthByUser;_itemHeightByUser=void 0;_itemHeight=0;_itemMaxWidth=0;_pager;static defaultAttributes={layout:"horizontal",title:{align:"start",space:ie,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:te,spaceRow:ee,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:se,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};constructor(t){super(i.merge({},de.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 o=s;a&&(o=s?.reverse());const l=e.createGroup({x:0,y:0});this._itemsContainer=l;const{layout:d,maxWidth:h,maxHeight:c,defaultSelected:u=[],autoPage:p}=this.attribute,b="horizontal"===d,{spaceCol:g=te,spaceRow:_=ee,maxWidth:m,width:y,height:x}=t;i.isValid(m)?i.isValid(y)?this._itemWidthByUser=Math.min(m,y):this._itemWidthByUser=m:i.isValid(y)&&(this._itemWidthByUser=y),i.isValid(x)&&(this._itemHeightByUser=x);let f=!1,v=0,A=0,S=0,E=1,k=1;o.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,o),a=s.attribute.width,d=s.attribute.height;this._itemHeight=Math.max(this._itemHeight,d),v=Math.max(a,v),this._itemMaxWidth=Math.max(a,this._itemMaxWidth),b?(E=r,i.isValid(h)&&(a>=h?(f=!0,e>0&&(A=0,S+=d+_,k+=1)):h<A+a&&(f=!0,A=0,S+=d+_,k+=1)),e>0&&s.setAttributes({x:A,y:S}),A+=g+a):(E=n,i.isValid(c)&&c<S+d&&(f=!0,S=0,A+=v+g,v=0,k+=1),e>0&&s.setAttributes({x:A,y:S}),S+=_+d),l.add(s)}));let B=!1;f&&p&&k>E&&(B=this._renderPager(b)),B||(l.setAttribute("y",this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",8):0),this._innerView.add(l))}_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:o,label:l,value:d,shape:h}=s,{padding:c=0,focus:u,focusIconStyle:p={}}=this.attribute.item;let{shape:b={},label:g={},value:_={},background:m={}}=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),m=this._handleStyle(m,s,a,n,r);const y=i.normalizePadding(c);let x;!1===m.visible?(x=e.createGroup({x:0,y:0,cursor:(m?.style).cursor}),this._appendDataToShape(x,t.LEGEND_ELEMENT_NAME.item,s,x)):(x=e.createGroup({x:0,y:0,...m?.style}),this._appendDataToShape(x,t.LEGEND_ELEMENT_NAME.item,s,x,m?.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,...h,...b.style});let k;Object.keys(b.state||{}).forEach((t=>{const e=b.state[t].fill||b.state[t].stroke;h.fill&&i.isNil(b.state[t].fill)&&e&&(b.state[t].fill=e),h.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 B=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:y}),this._appendDataToShape(k,t.LEGEND_ELEMENT_NAME.focus,s,x),B=a}const w=e.createText({x:A/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(g?.style).fontSize,...g?.style,text:g.formatMethod?g.formatMethod(l,s,n):l});this._appendDataToShape(w,t.LEGEND_ELEMENT_NAME.itemLabel,s,x,g?.state),w.addState(a?t.LegendStateValue.selected:t.LegendStateValue.unSelected),f.add(w);const M=i.get(g,"space",8);if(v+=A/2+S+w.AABBBounds.width()+M,i.isValid(d)){const r=i.get(_,"space",u?8:0),o=e.createText({x:v+M,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(_?.style).fontSize,..._?.style,text:_.formatMethod?_.formatMethod(d,s,n):d});this._appendDataToShape(o,t.LEGEND_ELEMENT_NAME.itemValue,s,x,_?.state),o.addState(a?t.LegendStateValue.selected:t.LegendStateValue.unSelected),this._itemWidthByUser&&(o.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-A-S-w.AABBBounds.width()-M-B-r),_.alignRight&&o.setAttributes({textAlign:"right",x:this._itemWidthByUser-A/2-y[1]-y[3]-B-r})),v=o.AABBBounds.x2+r,f.add(o)}else this._itemWidthByUser&&w.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-A-S-B);k&&(k.setAttribute("x",v),f.add(k));const L=f.AABBBounds,T=L.width(),C=L.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 x.attribute.width=P,x.attribute.height=I,f.translateTo(-L.x1+y[3],-L.y1+y[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:o=2,item:l={},pager:d={}}=this.attribute,{spaceCol:h=te,spaceRow:c=ee}=l,u=this._itemsContainer,{animation:p=!0,animationDuration:b=450,animationEasing:g="quadIn",space:_=se,...m}=d;let y,x=0,f=0,v=0,A=0,S=1;if(t){if(y=new Qt({layout:1===o?"horizontal":"vertical",total:99,...i.merge({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},m)}),this._pager=y,this._innerView.add(y),x=(o-1)*c+this._itemHeight*o,f=a-y.AABBBounds.width()-_,f<=0)return this._innerView.removeChild(y),!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+=h+i})),y.setAttributes({total:Math.ceil(S/o),x:f,y:s+x/2-y.AABBBounds.height()/2})}else{if(y=new Qt({layout:"horizontal",total:99,...m}),this._pager=y,this._innerView.add(y),f=this._itemMaxWidth*r+(r-1)*h,x=n-y.AABBBounds.height()-_-s,x<=0)return this._innerView.removeChild(y),!1;u.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;x<A+i&&(A=0,v+=this._itemMaxWidth+h,S+=1),e>0&&t.setAttributes({x:v,y:A}),A+=c+i})),y.setAttributes({total:Math.ceil(S/r),x:(f-y.AABBBounds.width())/2,y:n-y.AABBBounds.height()})}d.defaultCurrent>1&&(t?u.setAttribute("y",-(d.defaultCurrent-1)*(x+c)):u.setAttribute("x",-(d.defaultCurrent-1)*(f+h)));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+h)},b,g):t?u.setAttribute("y",-(i-1)*(x+c)):u.setAttribute("x",-(i-1)*(f+h))};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({},le,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((o=>{t.state[o]&&i.isFunction(t.state[o])&&(r.state[o]=t.state[o](e,s,a,n))})),r}}var he;function ce(t){return i.isArray(t)?t:[t,t]}function ue(t){return t?"ew-resize":"ns-resize"}t.SLIDER_ELEMENT_NAME=void 0,(he=t.SLIDER_ELEMENT_NAME||(t.SLIDER_ELEMENT_NAME={})).innerView="innerView",he.railContainer="sliderRailContainer",he.rail="sliderRail",he.startText="sliderStartText",he.endText="sliderEndText",he.startHandler="sliderStartHandler",he.startHandlerText="startHandlerText",he.endHandler="sliderEndHandler",he.endHandlerText="sliderEndHandlerText",he.track="sliderTrack",he.trackContainer="sliderTrackContainer";class pe 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({},pe.defaultAttributes,t))}setValue(t){const[e,s]=i.array(t),{layout:a,railWidth:n,railHeight:r,min:o,max:l}=this.attribute,{startHandler:d,endHandler:h}=this._getHandlers(),c="vertical"===a?r:n,u=(e-o)/(l-o)*c;if(d&&this._updateHandler(d,u,e),h){const t=(s-o)/(l-o)*c;this._updateHandler(h,t,s)}this._updateTrack()}render(){this.removeAllChild();const{layout:s="horizontal",railWidth:a,railHeight:n,startText:r,endText:o,min:l,max:d,showHandler:h=!0}=this.attribute;let{value:c}=this.attribute;i.isNil(c)&&(c=[l,d]),this._currentValue={startValue:ce(c)[0],endValue:ce(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 m=e.createGroup({x:0,y:0});let y;if(m.name=t.SLIDER_ELEMENT_NAME.railContainer,this._railContainer=m,_.add(m),this._renderRail(m),g+=u?a:n,o&&o.visible){const s=i.isValid(o.space)?o.space:0;y=e.createText({x:u?g+s:a/2,y:u?n/2:g+s,textAlign:u?"start":"center",textBaseline:u?"middle":"top",text:o.text,lineHeight:o.style?.fontSize,...o.style}),y.name=t.SLIDER_ELEMENT_NAME.endText,p.add(y)}this._renderTrack(m),h&&(this._renderHandlers(_),this._bindEvents())}_renderRail(i){const{railWidth:s,railHeight:a,railStyle:n,slidable:r}=this.attribute;let o="default";!1!==r&&(o="pointer");const l=e.createRect({x:0,y:0,width:s,height:a,cursor:o,...n});return l.name=t.SLIDER_ELEMENT_NAME.rail,i.add(l),this._rail=l,l}_renderHandlers(e){const{range:s,min:a,max:n,handlerSize:r=14,handlerStyle:o,handlerText:l,railHeight:d,railWidth:h,slidable:c}=this.attribute;let{value:u}=this.attribute;i.isNil(u)&&(u=[a,n]);const p=l&&l.visible,b=this._isHorizontal,g=b?h:d,[_,m]=ce(u),y=(_-a)/(n-a)*g,x=this._renderHandler({x:b?y:h/2,y:b?d/2:y,size:r,strokeBoundsBuffer:0,cursor:!1===c?"default":ue(b),...o});if(x.name=t.SLIDER_ELEMENT_NAME.startHandler,this._startHandler=x,e.add(x),this._currentValue.startPos=y,p){const i=this._renderHandlerText(_);i.name=t.SLIDER_ELEMENT_NAME.startHandlerText,e.add(i),this._startHandlerText=i}if(s){const i=(m-a)/(n-a)*g,s=this._renderHandler({x:b?i:h/2,y:b?d/2:i,size:r,strokeBoundsBuffer:0,cursor:!1===c?"default":ue(b),...o});if(s.name=t.SLIDER_ELEMENT_NAME.endHandler,this._endHandler=s,e.add(s),this._currentValue.endPos=i,p){const i=this._renderHandlerText(m);i.name=t.SLIDER_ELEMENT_NAME.endHandlerText,e.add(i),this._endHandlerText=i}}}_renderTrack(s){const{range:a,min:n,max:r,railHeight:o,railWidth:l,trackStyle:d,railStyle:h,slidable:c}=this.attribute;let{value:u}=this.attribute;i.isNil(u)&&(u=[n,r]);const p=this._isHorizontal,b=p?l:o;let[g,_]=ce(u);a||(g=n);const m=e.createGroup({x:0,y:0,width:l,height:o,cornerRadius:h?.cornerRadius,clip:!0,pickable:!1});m.name=t.SLIDER_ELEMENT_NAME.trackContainer;const y=i.isObject(a)&&!0===a.draggableTrack;let x;x=!1===c?"default":!1===a||!1===y?"pointer":ue(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:l,height:p?o:f,cursor:x,...d});v.name=t.SLIDER_ELEMENT_NAME.track,this._track=v,m.add(v),s.add(m)}_renderHandler(t){return e.createSymbol(t)}_renderHandlerText(t){const{align:i,min:s,max:a,handlerSize:n=14,handlerText:r={},railHeight:o,railWidth:l,slidable:d}=this.attribute,h=this._isHorizontal,c=(t-s)/(a-s)*(h?l:o),u=r.space??4,p={text:r?.formatter?r.formatter(t):t.toFixed(r?.precision??0),lineHeight:r.style?.lineHeight,cursor:!1===d?"default":ue(h),...r.style};h?"top"===i?(p.textBaseline="bottom",p.textAlign="center",p.x=c,p.y=(o-n)/2-u):(p.textBaseline="top",p.textAlign="center",p.x=c,p.y=(o+n)/2+u):"left"===i?(p.textBaseline="middle",p.textAlign="end",p.x=(l-n)/2-u,p.y=c):(p.textBaseline="middle",p.textAlign="start",p.x=(l+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,o,l,d=0;this._isHorizontal?(r=t.clientX,d=r-this._prePos,o=this._currentHandler?.attribute.x,l=e):(r=t.clientY,d=r-this._prePos,o=this._currentHandler?.attribute.y,l=s);const h=i.clamp(o+d,0,l),c=h/l*(n-a)+a;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,h,c):this._updateHandler(this._currentHandler,h,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:o}=this._getHandlers();let l,d,h;this._isHorizontal?(l=t.clientX,d=this._track.attribute.width,h=e):(l=t.clientY,d=this._track.attribute.height,h=s);const c=l-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=i.clamp(t+c,0,h-d),s=e/h*(n-a)+a;this._updateHandler(r,e,s)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=i.clamp(t+c,d,h),s=e/h*(n-a)+a;this._updateHandler(o,e,s),this._track.setAttributes(this._isHorizontal?{x:Math.min(r?.attribute.x,o?.attribute.x),width:Math.abs(r?.attribute.x-o?.attribute.x)}:{y:Math.min(r?.attribute.y,o?.attribute.y),height:Math.abs(r?.attribute.y-o?.attribute.y)})}this._prePos=l,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,o=this._endHandler;let l,d,h,c;this._isHorizontal?(l=t.viewX-this._rail.globalAABBBounds.x1,d=r?.attribute.x,h=o?.attribute.x,c=e):(l=t.viewY-this._rail.globalAABBBounds.y1,d=r?.attribute.y,h=o?.attribute.y,c=s);const u=l/c*(n-a)+a;if(i.isValid(h)){const t=Math.abs(l-d)>Math.abs(l-h)?o:r;this._updateHandler(t,l,u)}else this._updateHandler(r,l,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 be extends oe{name="colorLegend";static defaultAttributes={layout:"horizontal",title:{align:"start",space:ie,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({},be.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:o,value:l,railWidth:d,railHeight:h,showHandler:c=!0,handlerSize:u,handlerStyle:p,railStyle:b,trackStyle:g,startText:_,endText:m,handlerText:y,showTooltip:x,tooltip:f}=this.attribute,v=[],A=(o-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 pe({x:0,y:0,range:{draggableTrack:!0},slidable:e,layout:a,align:n,min:r,max:o,value:l,railWidth:d,railHeight:h,showHandler:c,handlerSize:u,handlerStyle:p,railStyle:b,trackStyle:{fill:this._color,...g},startText:_,endText:m,handlerText:y,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",ie):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:o,endValue:l,startPos:d,endPos:h}=this._slider.currentValue,c=this._colorScale.scale(o),u=this._colorScale.scale(l);a?.setAttribute("fill",c),n?.setAttribute("fill",u);const p="horizontal"===t?i:s;if(Math.abs(d-h)!==p&&e&&e.length>1){const t=this._color.stops,e=Math.min(d,h),i=Math.max(d,h),s=e/p,a=i/p,n=a-s,c=t.filter((t=>t.offset>s&&t.offset<a)),u=Math.min(o,l),b=Math.max(o,l),g=this._colorScale.scale(u),_=this._colorScale.scale(b),m=[{offset:0,color:g}];c.forEach((t=>{m.push({offset:(t.offset-s)/n,color:t.color})})),m.push({offset:1,color:_}),r.setAttribute("fill",{...this._color,stops:m})}}}function ge(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 _e extends oe{name="sizeLegend";static defaultAttributes={layout:"horizontal",title:{align:"start",space:ie,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({},_e.defaultAttributes,t))}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:s,align:a,min:n,max:r,value:o,railWidth:l,railHeight:d,showHandler:h=!0,handlerSize:c,handlerStyle:u,railStyle:p,trackStyle:b,startText:g,endText:_,handlerText:m,showTooltip:y,tooltip:x,sizeBackground:f}=this.attribute,v=e.createGroup({x:0,y:0});this._innerView.add(v);const A=new pe({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:s,align:a,min:n,max:r,value:o,railWidth:l,railHeight:d,showHandler:h,handlerSize:c,handlerStyle:{symbolType:ge(a),...u},railStyle:p,trackStyle:b,startText:g,endText:_,handlerText:m,showTooltip:y,tooltip:x});v.add(A);let S,E=0;const k=12;"horizontal"===s?"top"===a?(S=`M0,0L${l},0L${l},12Z`,E=d):(S=`M0,12L${l},12L${l},0Z`,A.setAttribute("y",k)):"left"===a?S=`M${l},0L${l},0L${l+k},${d}L${l},${d}Z`:(S=`M0,${d}L12,${d}L12,0Z`,A.setAttribute("x",k));const B=e.createPath({x:0,y:E,path:S,...f,zIndex:0});v.add(B);const w=this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",ie):0;v.translate(0-v.AABBBounds.x1,w-v.AABBBounds.y1),this._slider=A}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}_onSliderChange=t=>{this.dispatchEvent(t)}}class me 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({},me.defaultAttributes,t))}render(){const{text:t,textStyle:e,subtext:s,subtextStyle:a,width:n,height:r,minWidth:o,maxWidth:l,minHeight:d,maxHeight:h,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,m=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 y=this._subTitle?this._subTitle?.AABBBounds.height():0,x=this._subTitle?this._subTitle?.AABBBounds.width():0;let f=Math.max(m,x),v=_+(a?.height??y);if(i.isValid(n)&&(f=n,this._mainTitle?.setAttribute("maxLineWidth",n),this._subTitle?.setAttribute("maxLineWidth",n)),i.isValid(r)&&(v=r),i.isValid(o)&&f<o&&(f=o),i.isValid(l)&&(this._mainTitle?.setAttribute("maxLineWidth",l),this._subTitle?.setAttribute("maxLineWidth",l),this._mainTitle?.setAttribute("maxWidth",l),this._subTitle?.setAttribute("maxWidth",l),f>l&&(f=l)),i.isValid(d)&&v<d&&(v=d),i.isValid(h)&&(this._mainTitle?.setAttribute("maxHeight",h),this._subTitle?.setAttribute("maxHeight",h-_),v>h&&(v=h)),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??m;"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 ye={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 xe=(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 o=(i+s)/2,l=n+a,d=r+a;t.round&&(i=Math.round(i),s=Math.round(s),n=Math.round(n),r=Math.round(r),l=Math.round(l),d=Math.round(d),o=Math.round(o));const h=Math.abs(s-i)>1e-6,c=t.endArrow&&h?`L${s},${r-a/2}L${s+a},${(r+d)/2}L${s},${d+a/2}`:"",u=t.startArrow&&h?`L${i},${l+a/2}L${i-a},${(n+l)/2}L${i},${n-a/2}`:"";return!1===t.isSmooth?`M${i},${n}L${s},${r}${c}L${s},${d}L${i},${l}${u}Z`:`M${i},${n}\n C${o},${n},${o},${r},${s},${r}\n ${c}\n L${s},${d}\n C${o},${d},${o},${l},${i},${l}\n ${u}\n Z`},fe=(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 o=(i+s)/2,l=a+r,d=n+r;t.round&&(i=Math.round(i),s=Math.round(s),a=Math.round(a),n=Math.round(n),l=Math.round(l),d=Math.round(d),o=Math.round(o));const h=Math.abs(s-i)>1e-6,c=t.endArrow&&h?`L${n-r/2},${s}L${(n+d)/2},${s+r}L${d+r/2},${s}`:"",u=t.startArrow&&h?`L${l+r/2},${i}L${(l+a)/2},${i-r}L${a-r/2},${i}`:"";return!1===t.isSmooth?`M${a},${i}L${n},${s}${c}L${d},${s}L${l},${i}${u}Z`:`M${a},${i}\n C${a},${o},${n},${o},${n},${s}\n ${c}\n L${d},${s}\n C${d},${o},${l},${o},${l},${i}\n ${u}\n Z`};class ve extends n{static defaultAttributes={direction:"horizontal",align:"start"};_container;_backPath;_frontPath;constructor(t){super(i.merge({},ve.defaultAttributes,t))}render(){const{direction:t="horizontal"}=this.attribute,e="vertical"===t?fe:xe,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 Ae extends e.Symbol{constructor(t){super(t)}}var Se,Ee;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(Se||(Se={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(Ee||(Ee={}));class ke extends n{static defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"};static defaultAttributes={visible:!0,[Ee.Start]:{},[Ee.Pause]:{},[Ee.Backward]:{},[Ee.Forward]:{}};_isPaused=!0;_playController;_forwardController;_backwardController;_layout;_startAttr;_pauseAttr;_forwardAttr;_backwardAttr;constructor(t){super(i.merge({},ke.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",...ke.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",...ke.defaultControllerAttr,...this.attribute.pause.style}},this._forwardAttr={style:{...ke.defaultControllerAttr,...this.attribute.forward.style}},this._backwardAttr={style:{...ke.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 Ae({...this._startAttr.style}),this.add(this._playController))};_initBackward=()=>{i.isNil(this._backwardController)&&(this._backwardController=new Ae({...this._backwardAttr.style}),this.add(this._backwardController))};_initForward=()=>{i.isNil(this._forwardController)&&(this._forwardController=new Ae({...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(Se.OnPlay);this.dispatchEvent(t)};pause=()=>{const t=this._createCustomEvent(Se.OnPause);this.dispatchEvent(t)};forward=()=>{const t=this._createCustomEvent(Se.OnForward);this.dispatchEvent(t)};backward=()=>{const t=this._createCustomEvent(Se.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 Be={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},we=[200,10];var Me,Le;t.DirectionEnum=void 0,(Me=t.DirectionEnum||(t.DirectionEnum={})).Default="default",Me.Reverse="reverse",t.PlayerEventEnum=void 0,(Le=t.PlayerEventEnum||(t.PlayerEventEnum={})).OnChange="onChange",Le.OnPlay="onPlay",Le.OnPause="onPause",Le.OnBackward="onBackward",Le.OnForward="onForward",Le.OnEnd="onEnd";const Te=({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}),Ce=({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}),Pe=t=>"top"===t||"bottom"===t;class Ie 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:{...Be,key:"start",position:"start",space:0},pause:{...Be,key:"pause",position:"start"},forward:{...Be,key:"forward",position:"end"},backward:{...Be,key:"backward",position:"start"}}};_slider;_controller;_data=[];_minIndex;_maxIndex;_railStyle;_trackStyle;_handlerStyle;_start;_pause;_forward;_backward;_size;_orient;_layoutInfo={};constructor(t){super(i.merge({},Ie.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=(Pe(this._orient)?this._railStyle.height:this._railStyle.width)??we[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=(Pe(this._orient)?this._size?.width:this._size?.height)-n,o=r-this.attribute.slider.space,l=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:Pe(this._orient)?t+a:(this._size.width-r)/2,y:Pe(this._orient)?(this._size.height-r)/2:t+a},t+a+r}),0);this._layoutInfo.slider={...this._layoutInfo.slider,size:o,x:Pe(this._orient)?l+this.attribute.slider.space:(this._size.width-a)/2,y:Pe(this._orient)?(this._size.height-a)/2:l+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:Pe(this._orient)?t+a:(this._size.width-r)/2,y:Pe(this._orient)?(this._size.height-r)/2:t+a},t+a+r}),l+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(Pe(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=this._railStyle.height??we[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??we[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 pe(t),this.add(this._slider)};_updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return Pe(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 ke(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 He;t.IOperateType=void 0,(He=t.IOperateType||(t.IOperateType={})).drawStart="drawStart",He.drawEnd="drawEnd",He.drawing="drawing",He.moving="moving",He.moveStart="moveStart",He.moveEnd="moveEnd",He.brushClear="brushClear";const ze={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}},Ve=5,De={debounce:i.debounce,throttle:i.throttle};class Re extends n{name="brush";static defaultAttributes=ze;_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({},Re.defaultAttributes,t))}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",De[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,o=a.map((t=>({x:t.x+n,y:t.y+r})));if(i.polygonContainPoint(o,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:o,x2:l,y1:d,y2:h}=this._operatingMask.globalAABBBounds,c=n-o,u=r-l,p=s-d,b=a-h;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:o=Ve}=this.attribute;if(this._isDrawedBeforeEnd=!!(Math.abs(a-s)>o||Math.abs(n-r)>o),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 l=this._computeMaskPoints();this._operatingMask.setAttribute("points",l),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,o=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:o}),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 Oe=(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)})},Ne=t=>{const{width:e,height:s,wordBreak:a="break-word",textAlign:n,textBaseline:r,text:o}=t;return{width:e,height:s,wordBreak:a,textAlign:n,textBaseline:r,singleLine:!1,textConfig:i.array(o).map((e=>({...t,text:e})))}},$e={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},Ue=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"],Fe="tooltip-title",Ge="tooltip-content",We="shape",Xe="value";class Ye extends n{name="tooltip";_tooltipPanel;_tooltipTitleContainer;_tooltipTitleSymbol;_tooltipTitle;_tooltipContent;static defaultAttributes=$e;constructor(t){super(i.merge({},Ye.defaultAttributes,t))}render(){const{visible:t,content:e,panel:s,keyWidth:a,valueWidth:n,hasContentShape:r,autoCalculatePosition:o,autoMeasure:d}=this.attribute;if(!t)return void this.hideAll();d&&Ye.measureTooltip(this.attribute),o&&Ye.calculateTooltipPosition(this.attribute);const h=i.normalizePadding(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",{visible:!0,...s},"rect"),this._tooltipTitleContainer=this.createOrUpdateChild(Fe,{visible:!0,x:h[3],y:h[0]},"group");const c=Ye.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild(`${Fe}-${We}`,i.merge({symbolType:"circle"},c.shape,{visible:l(c)&&l(c.shape)}),"symbol"),c.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild(`${Fe}-${Xe}`,{visible:l(c)&&l(c.value),...Ne(c.value)},"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild(`${Fe}-${Xe}`,{text:"",visible:l(c)&&l(c.value),...c.value},"text");const u=l(c.shape)?c.shape.size+c.shape.spacing:0,{textAlign:p,textBaseline:b}=c.value,g=s.width-h[3]-h[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 _=l(c)?c.height+c.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild(Ge,{visible:!0},"group"),this._tooltipContent.removeAllChild(),e?.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+_);let t=0;e.forEach(((e,s)=>{const o=Ye.getContentAttr(this.attribute,s);if(!l(o))return;const d=`${Ge}-${s}`,h=this._tooltipContent.createOrUpdateChild(d,{visible:!0,x:0,y:t},"group");let c=0;if(l(o.shape)&&h.createOrUpdateChild(`${d}-${We}`,{visible:!0,x:o.shape.size/2,y:o.shape.size/2+((o.key.lineHeight??o.key.fontSize)-o.shape.size)/2,...o.shape},"symbol"),r&&(c+=o.shape.size+o.shape.spacing),l(o.key)){let t;t=o.key.multiLine?h.createOrUpdateChild(`${d}-key`,{visible:!0,...Ne(o.key),textBaseline:"top"},"richtext"):h.createOrUpdateChild(`${d}-key`,{visible:!0,...o.key,textBaseline:"top"},"text");const{textAlign:e}=o.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+o.key.spacing}if(l(o.value)){let t;t=o.value.multiLine?h.createOrUpdateChild(`${d}-${Xe}`,{visible:!0,...Ne(o.value),textBaseline:"top"},"richtext"):h.createOrUpdateChild(`${d}-${Xe}`,{visible:!0,...o.value,textBaseline:"top"},"text");let e="right";i.isValid(o.value.textAlign)?e=o.value.textAlign:l(o.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),h.add(t)}t+=o.height+o.spaceRow}))}}setAttributes(t,e){const s=Object.keys(t);this.attribute.autoCalculatePosition&&s.every((t=>Ue.includes(t)))?(this._mergeAttributes(t,s),i.isNil(this.attribute.panel.width)&&this.attribute.autoMeasure&&Ye.measureTooltip(this.attribute),Ye.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:o,positionY:l,parentBounds:d}=t;let h=n,c=r;return"left"===o?h-=e+s:"center"===o?h-=e/2:h+=s,"top"===l?c-=i+a:"middle"===l?c-=i/2:c+=a,h+e>d.x2&&(h-=e+s),c+i>d.y2&&(c-=i+a),h<d.x1&&(h=d.x1),c<d.y1&&(c=d.y1),t.x=h,t.y=c,t}static measureTooltip(t){const{content:s,contentStyle:a}=t,n=i.normalizePadding(t.padding),r=Ye.getTitleAttr(t);let o=0,d=n[0]+n[2],h=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);o=t,h=e}if(p&&e.builtinSymbolsMap[b]&&(o+=u.size+u.spacing,h=Math.max(u.size,h)),t.title&&(t.title.width=o,t.title.height=h),l(r)&&(d+=h+r.spaceRow),s?.length){const i=[];if(s.forEach(((e,s)=>{const a=Ye.getContentAttr(t,s);(e.key||e.value)&&l(a)&&i.push([e,a])})),i.length){let n=!1;const r=[],h=[],c=[];i.forEach((([t,s],o)=>{const{key:u,value:p,shape:b,spaceRow:g}=s,_=l(b),m=b?.symbolType??"",y=A(u),x=A(p);let f=0;if(l(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),f=Math.max(f,e)}if(l(p)){const{width:t,height:e}=x.quickMeasure(p.text);c.push(t),f=Math.max(f,e)}_&&e.builtinSymbolsMap[m]&&(n=!0,r.push(b.size),f=Math.max(b.size,f)),t.height=f,d+=f,o<i.length-1&&(d+=g??a.spaceRow)}));const u=r.length?Math.max(...r):0,p=h.length?Math.max(...h):0,b=c.length?Math.max(...c):0;o=Math.max(p+b+a.key.spacing+a.value.spacing+(n?u+a.shape.spacing:0),o),s.forEach((t=>{t.width=o})),t.hasContentShape=n,t.keyWidth=p,t.valueWidth=b}}return t.panel.width=o+n[1]+n[3],t.panel.height=d,t}static getTitleAttr(t){return Oe({},Ye.defaultAttributes.titleStyle,Ye.defaultAttributes.title,t.titleStyle,t.title)}static getContentAttr(t,e){return Oe({},Ye.defaultAttributes.contentStyle,t.contentStyle,t.content[e])}}t.AbstractComponent=n,t.BasePlayer=Ie,t.Brush=Re,t.CircleAxis=Pt,t.CircleCrosshair=$,t.ColorContinuousLegend=be,t.ContinuousPlayer=class extends Ie{_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(Se.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(Se.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(Se.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(Se.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=te,t.DEFAULT_ITEM_SPACE_ROW=ee,t.DEFAULT_LABEL_SPACE=8,t.DEFAULT_PAGER_SPACE=se,t.DEFAULT_SHAPE_SIZE=10,t.DEFAULT_SHAPE_SPACE=8,t.DEFAULT_STATES=At,t.DEFAULT_TITLE_SPACE=ie,t.DEFAULT_VALUE_SPACE=8,t.DataLabel=bt,t.DataZoom=Rt,t.DiscreteLegend=de,t.DiscretePlayer=class extends Ie{_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(Se.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(Se.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(Se.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(Se.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,(Te({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||Ce({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=yt,t.GroupFadeIn=Ht,t.GroupFadeOut=zt,t.GroupTransition=It,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,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==t)return void(o&&o.hideAll());if(i.isValid(e))if(!1!==e.visible){const t=i.merge({},i.get(ye,"title.style"),e.style);this._title=o.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=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(i.isValid(s)){const t=this._title&&e?.space?e.space:0,a=i.array(s),d=[];let h=0;a.forEach(((e,s)=>{if(!1!==e.visible){const a=i.merge({},i.get(ye,"content.style"),e.style),c=o.createOrUpdateChild("indicator-content-"+s,{...a,lineHeight:i.isValid(a.lineHeight)?a.lineHeight:a.fontSize,visible:e.visible,x:0,y:l+t+h},"text");e.autoFit&&i.isValidNumber(r)&&this._setAutoFit(r,c,e),e.autoLimit&&i.isValidNumber(n)&&c.setAttribute("maxLineWidth",r),d.push(c);const u=e?.space?e.space:0;h+=c.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=d}const d=o?.AABBBounds.height()??0;o.setAttribute("y",a.height/2-d/2),o.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=dt,t.LineAxis=Ct,t.LineCrosshair=O,t.LineLabel=ut,t.LinkPath=ve,t.MarkArea=qt,t.MarkLine=jt,t.MarkPoint=Jt,t.Pager=Qt,t.PolygonCrosshair=F,t.PopTip=k,t.RectCrosshair=N,t.RectLabel=ct,t.ScrollBar=r,t.SectorCrosshair=U,t.Segment=xt,t.SizeContinuousLegend=_e,t.Slider=pe,t.SymbolLabel=ht,t.Tag=E,t.Title=me,t.Tooltip=Ye,t.getHorizontalPath=xe,t.getSizeHandlerPath=ge,t.getVerticalPath=fe,t.loadPoptip=function(t){i.merge(I.poptip,t),e.container.load(D)},t.popTipModule=D,t.setPoptipTheme=function(t){i.merge(I.poptip,P,t)},t.version="0.13.11"}));
|
|
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:o,padding:l=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 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=d.createOrUpdateChild("slider",{...b,cornerRadius:this._getDefaultSliderCornerRadius(),...o,boundsPadding:i.normalizePadding(l),pickMode:"imprecise"},"rect");this._slider=g,this._container=d;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,o]=i.normalizePadding(s),l={x1:o,y1:a,x2:t-n,y2:e-r,width:t-(o+n),height:e-(a+r)};return this._sliderRenderBounds=l,l}_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:o,y1:l}=this._getSliderRenderBounds(),d=this._sliderSize;return"horizontal"===e?i.clampRange([o+s*n,o+a*n],o,n-d):i.clampRange([l+s*r,l+a*r],l,r-d)}_onRailPointerDown=t=>{const{viewX:e,viewY:s}=t,{direction:a,width:n,height:r,range:o}=this.attribute,l=this._sliderSize,[d,h]=this._getScrollRange();let c;if("vertical"===a){const t=s-this._viewPosition.y,e=i.clamp(t-l/2,d,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,s=i.clamp(t-l/2,d,h);c=t/n,this._slider.setAttribute("x",s,!0)}this.setScrollRange([c-(o[1]-o[0])/2,c+(o[1]-o[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:o}=this._getSliderRenderBounds();"vertical"===e?(s=t.clientY,a=s-this._prePos,i=a/o):(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 o(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&o(t,e)}))}const l=t=>!i.isNil(t)&&!1!==t.visible,d=["#ffffff","#000000"];function h(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(...d);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,o,l;r=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),l=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4);return.2126*r+.7152*o+.0722*l}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)),o=r&&(i*a+s*n)/r;return Math.acos(Math.min(Math.max(o,-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 m=-.5*Math.PI,y=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:o,padding:l=4,visible:d,state:h}=this.attribute,c=i.normalizePadding(l),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,m=0;const{visible:y,...x}=s;if(i.isBoolean(y)){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:y,x:e/2,y:e/2},"symbol"),i.isEmpty(h?.shape)||(p.states=h.shape),y&&(m=e+n)}b+=m,_+=m;const f={text:t,visible:i.isValid(t)&&!1!==d,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(h?.text)||(v.states=h.text);const A=S(f.text,e),E=A.width,k=A.height;b+=E;const B=s.size??10,w=i.isNumber(B)?B:Math.max(B[0],B[1]);g+=Math.max(k,s?.visible?w:0);const{textAlign:M,textBaseline:L}=e;(i.isValid(r)||i.isValid(o))&&(i.isValid(r)&&b<r&&(b=r),i.isValid(o)&&b>o&&(b=o,v.setAttribute("maxLineWidth",o-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",-m/2)):"right"===M||"end"===M?(T-=b,p&&p.setAttribute("x",(p.attribute.x||0)-E),u.setAttribute("x",-c[1]-m)):"left"!==M&&"start"!==M||u.setAttribute("x",c[3]),"middle"===L?(C-=g/2,p&&p.setAttribute("y",0)):"bottom"===L?(C-=g,p&&p.setAttribute("y",-k/2),u.setAttribute("y",-c[2])):"top"===L&&(u.setAttribute("y",c[0]),p&&p.setAttribute("y",k/2));const{visible:P,...I}=a;if(d&&i.isBoolean(P)){const e=this.createOrUpdateChild("tag-panel",{...I,visible:P&&!!t,x:T,y:C,width:b,height:g},"rect");i.isEmpty(h?.panel)||(e.states=h.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:o=4,minWidth:l=0,maxWidth:d=1/0,padding:h=4,visible:c,state:u,dx:p=0,dy:b=0}=this.attribute,g=i.normalizePadding(h),_=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group"),m=d-g[1]-g[3],y=i.isValid(t)&&!1!==c,x={text:t,visible:y,...e,x:g[3],y:g[0],maxLineWidth:m,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+o;y||(E=0);const k=i.isValid(a)&&!1!==c,B={text:a,visible:k,...n,x:g[3],y:g[0]+E,maxLineWidth:m,textAlign:"left",textBaseline:"top"},w=_.createOrUpdateChild("poptip-content",B,"text");i.isEmpty(u?.content)||(w.states=u.content);const M=w.AABBBounds,L=M.height(),T=M.width();k&&(E+=L);let C=i.max(S+g[1]+g[3],T+g[1]+g[3]);C>d?C=d:C<l&&(C=l);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),D=H.lineWidth??1,R=this.stage?[this.stage.width,this.stage.height]:void 0,O="auto"===s;let N,$=-1/0;for(let t=0;t<this.positionList.length+1;t++){const e=O?this.positionList[t===this.positionList.length?N:t]:s,{angle:a,offset:n,rectOffset:r}=this.getAngleAndOffset(e,C,P,i.isArray(V)?V:[V,V-D]);if(i.isBoolean(I)){const t=(i.isArray(z)?z[0]:z)/4,e=_.createOrUpdateChild("poptip-symbol-panel",{...H,visible:I&&(k||y),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||y),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}),!O||!R)break;{const e=this.AABBBounds,s=(new i.Bounds).setValue(0,0,R[0],R[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,N=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 B="inversify:paramtypes";function w(t){return w="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},w(t)}var M=0;var L=function(t){this.id=M++,this.registry=t};function T(){return function(t){if(Reflect.hasOwnMetadata(B,t))throw new Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(B,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":w(Reflect))&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(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,o,l,d,h,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}),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}));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 D=new L((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 R extends n{name="crosshair";render(){this.renderCrosshair(this)}}class O extends R{static defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};constructor(t){super(i.merge({},O.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 N extends R{static defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};topLabelShape;bottomLabelShape;leftLabelShape;rightLabelShape;constructor(t){super(i.merge({},N.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 R{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 R{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=m,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})}}class F extends R{static defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};constructor(t){super(i.merge({},F.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:s,sides:a=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:o}=this.attribute,l=(o-r)%(2*Math.PI)==0,d=(o-r)/a;let h;for(let t=0;t<=a;t++){const n=r+d*t,o=i.polarToCartesian(e,s,n);0===t?h=`M${o.x},${o.y}`:h+=`L${o.x},${o.y}`,t===a&&l&&(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)}}const G=5,W=31,X=32,Y=new Uint32Array(X+1),Z=new Uint32Array(X+1);Z[0]=0,Y[0]=~Z[0];for(let t=1;t<=X;++t)Z[t]=Z[t-1]<<1|1,Y[t]=~Z[t];function j(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+X)/X));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>>>G]&1<<(a&W)},set:(e,i)=>{const a=i*t+e;s(a>>>G,1<<(a&W))},clear:(e,i)=>{const s=i*t+e;a(s>>>G,~(1<<(s&W)))},getRange:({x1:s,y1:a,x2:n,y2:r})=>{if(n<0||r<0||s>t||a>e)return!0;let o,l,d,h,c=r;for(;c>=a;--c)if(o=c*t+s,l=c*t+n,d=o>>>G,h=l>>>G,d===h){if(i[d]&Y[o&W]&Z[1+(l&W)])return!0}else{if(i[d]&Y[o&W])return!0;if(i[h]&Z[1+(l&W)])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 o,l,d,h,c;for(;a<=r;++a)if(o=a*t+i,l=a*t+n,d=o>>>G,h=l>>>G,d===h)s(d,Y[o&W]&Z[1+(l&W)]);else for(s(d,Y[o&W]),s(h,Z[1+(l&W)]),c=d+1;c<h;++c)s(c,4294967295)},clearRange:({x1:e,y1:i,x2:s,y2:n})=>{let r,o,l,d,h;for(;i<=n;++i)if(r=i*t+e,o=i*t+s,l=r>>>G,d=o>>>G,l===d)a(l,Z[r&W]|Y[1+(o&W)]);else for(a(l,Z[r&W]),a(d,Y[1+(o&W)]),h=l+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,o=i[a>>>G]&1<<(a&W);n[r+0]=255*o,n[r+1]=255*o,n[r+2]=255*o,n[r+3]=31}return a}}}(a,n),r.ratio=s,r.padding=i,r.width=t,r.height=e,r}function q(t,e,s=!1){if(s){const{x1:s,x2:a,y1:n,y2:r}=e,o=i.clamp(s,0,t.width),l=i.clamp(a,0,t.width),d=i.clamp(n,0,t.height),h=i.clamp(r,0,t.height);return{x1:t(o),x2:t(l),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=q(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,q(t,r.AABBBounds),a))return e.setRange(q(t,r.AABBBounds,!0)),s[n]}return!1}function tt(t,e,s,a,n,r,o){if("bound"===s.type||"position"===s.type){if(i.isFunction(o)){const l=((i.isFunction(s.position)?s.position(n.attribute):s.position)||function(t){if("rect"===t)return it;return et}(a.type)).map((t=>o(n.AABBBounds,r,t,a.offset)));return Q(t,e,n,l,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,o=Math.min(s,a),l=Math.max(s,a),d=Math.min(n,r),h=Math.max(n,r);let c=0,u=0;return o<0&&l-o<=e?c=-o:l>e&&o-(l-e)>=0&&(c=e-l),d<0&&h-d<=i?u=-d:h>i&&d-(h-i)>=0&&(u=i-h),{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",ot=300,lt="linear";class dt extends n{name="label";_baseMarks;_bitmap;setBitmap(t){this._bitmap=t}_bmpTool;setBitmapTool(t){this._bmpTool=t}_graphicToText;_idToGraphic;onAfterLabelOverlap;_lastHover;_lastSelect;_enableAnimation;render(){this._prepare();const{overlap:t,smartInvert:e,dataFilter:s,customLayoutFunc:a,customOverlapFunc:n}=this.attribute;let r,o=this.attribute.data;i.isFunction(s)&&(o=s(o)),i.isFunction(a)?r=a(o,(t=>this._idToGraphic.get(t.id))):(r=this.layout(o),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),o(this,(t=>{t===e||i.isEmpty(t.states)||t.addState(f.hoverReverse,!0)})),this._lastHover=e)};_onUnHover=t=>{this._lastHover&&(o(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 o(this,(t=>{i.isEmpty(t.states)||(t.removeState(f.selectedReverse),t.removeState(f.selected))}));i.isEmpty(e.states)||(e.addState(f.selected,!0),o(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=this.getBaseMarks(),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=[];for(let r=0;r<t.length;r++){const o=t[r],l=this._idToGraphic.get(o.id),d={...e,...o},h=this._createLabelText(d),c=this.getGraphicBounds(h),u=this.getGraphicBounds(l,{x:o.x,y:o.y}),p=this.labeling(c,u,i.isFunction(s)?s(o):s,a);p&&(d.x=p.x,d.y=p.y,h.setAttributes(p),n.push(h))}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:o=[],hideOnHit:l=!0,clampForce:d=!0}=e,h=this._bmpTool||j(n.width,n.height),c=this._bitmap||h.bitmap(),u=o.some((t=>"bound"===t.type));r&&this._baseMarks?.forEach((t=>{t.AABBBounds&&c.setRange(q(h,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(h,c,i.AABBBounds,d)){if(!u){c.setRange(q(h,i.AABBBounds,!0)),s.push(i);continue}if(u&&a?.AABBBounds&&K(i.AABBBounds,a?.AABBBounds)){c.setRange(q(h,i.AABBBounds,!0)),s.push(i);continue}}let n=!1;for(let r=0;r<o.length;r++)if(n=tt(h,c,o[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(d){const{dx:t=0,dy:e=0}=st(i,h.width,h.height);if((0!==t||0!==e)&&J(h,c,{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}),c.setRange(q(h,i.AABBBounds,!0)),s.push(i);continue}}!n&&!l&&s.push(i)}return i.isFunction(this.onAfterLabelOverlap)&&this.onAfterLabelOverlap(c),s}getBaseMarks(){const t=this.getBaseMarkGroup();if(t)return t.getChildren()}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??ot,o=s.easing??lt,l=s.delay??0,d=new Map,h=this._graphicToText||new Map,c=[];t.forEach(((t,u)=>{const p=this._idToGraphic.get(t.attribute.id),b=h?.get(p)?"update":"enter";if("enter"===b)if(c.push(t),d.set(p,t),!a&&p){const{from:e,to:i}=nt(t.attribute,"fadeIn");this.add(t),p.onAnimateBind=()=>{t.setAttributes(e);const s=this._afterRelatedGraphicAttributeUpdate(t,c,u,p,{mode:n,duration:r,easing:o,to:i,delay:l});p.on("afterAttributeUpdate",s)}}else this.add(t);if("update"===b){const n=h.get(p);h.delete(p),d.set(p,n),a?n.setAttributes(t.attribute):(n.animate().to(t.attribute,r,o),!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,o)))}})),h.forEach((t=>{a?this.removeChild(t):t?.animate().to(nt(t.attribute,"fadeOut").to,r,o).onEnd((()=>{this.removeChild(t)}))})),this._graphicToText=d}_afterRelatedGraphicAttributeUpdate(t,i,s,a,{mode:n,duration:r,easing:o,to:l,delay:d}){const h=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(l);const p=()=>{a&&(a.onAnimateBind=void 0,a.removeEventListener("afterAttributeUpdate",h))};switch(n){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(d).to(l,r,o);break;case"after-all":s===i.length-1&&u.animationState.end&&i.forEach((t=>{t.animate({onEnd:p}).wait(d).to(l,r,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(d).to(l,r,o)}};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),o=K(n.AABBBounds,r?.AABBBounds);if(n.attribute.stroke&&n.attribute.lineWidth>0)n.setAttributes({fill:h(n.attribute.fill,n.attribute.stroke,i,s,a)});else if(o){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{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({},ht.defaultAttributes,t))}labeling(t,e,i="top",s=0){if(!t)return;const{x1:a,y1:n,x2:r,y2:o}=t,l=Math.abs(r-a),d=Math.abs(o-n),h=(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:h+u*(s+b)+Math.sign(u)*(l/2),y:c+p*(s+g)+Math.sign(p)*(d/2)}}}class ct extends dt{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:o}=t,l=Math.abs(r-a),d=Math.abs(o-n),h=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*h,p+=g*c;let _=0,m=0;const y=i.includes("inside");i.includes("top")?m=y?1:-1:i.includes("bottom")?m=y?-1:1:i.includes("left")?_=y?1:-1:i.includes("right")&&(_=y?-1:1);return{x:u+_*s+_*l/2,y:p+m*s+m*d/2}}}class ut extends dt{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),o=e.x1;let l=o;return"end"===i?l=o+r/2+s:"start"===i&&(l=o-r/2-s),{x:l,y:e.y1}}}const pt={rect:ct,symbol:ht};class bt extends n{name="data-label";_componentMap;static defaultAttributes={pickable:!1};constructor(t){super(i.merge({},bt.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=j(s,a),r=n.bitmap(),o=new Map,l=this._componentMap;for(let e=0;e<t.length;e++){const i=t[e];if(pt[i.type]){const{baseMarkGroupName:t}=i;let e=this._componentMap.get(t);e?(e.setBitmapTool(n),e.setBitmap(r),e.setAttributes(i),o.set(t,e)):(e=new pt[i.type](i),e.setBitmap(r),e.setBitmapTool(n),this.add(e),o.set(t,e))}}l.forEach(((t,e)=>{o.get(e)||this.removeChild(t)})),this._componentMap=o}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function gt(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function _t(t,e,s,a){let n="";if(!t||0===e.length)return n;const r=e[0],o=i.PointService.distancePP(t,r),l=s?0:1;return a?n+=`M${t.x},${t.y-o}A${o},${o},0,0,${l},${t.x},${t.y+o}A${o},${o},0,0,${l},${t.x},${t.y-o}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${o},${o},0,0,${l},${t.x},${t.y}`})),n}function mt(t,e,s){const{type:a,closed:n}=s,r=e.slice(0).reverse();let o="",l="";if("line"===a&&s.smoothLink&&s.center){const e=t[0],a=r[0],d=s.center;o=gt(t,!!n),l=gt(r,!!n);const h=i.PointService.distancePP(a,d),c=i.PointService.distancePP(e,d);o+=`A${h},${h},0,0,1,${a.x},${a.y}L${a.x},${a.y}`,l+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===a){const{center:e}=s;o=_t(e,t,!1,!!n),l=_t(e,r,!0,!!n)}else"line"!==a&&"polygon"!==a||(o=gt(t,!!n),l=gt(r,!!n));return n?o+=l:(l="L"+l.substring(1),o+=l,o+="Z"),o}class yt extends n{name="grid";static defaultAttributes={style:{lineWidth:1,stroke:"#416180"},zIndex:0};constructor(t){super(i.merge({},yt.defaultAttributes,t))}render(){this.removeAllChild();const{type:t,items:s,style:a,closed:n,alternateColor:r,depth:o=0}=this.attribute;if(!i.isEmpty(s)&&(s.forEach(((s,r)=>{const{id:l,points:d}=s;let h="";if("line"===t||"polygon"===t)h=gt(d,!!n);else if("circle"===t){const{center:t}=this.attribute;h=_t(t,d,!1,!!n)}const c=e.createPath({path:h,z:o,...i.isFunction(a)?i.merge({},yt.defaultAttributes.style,a(s,r)):a});c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${l}`),this.add(c)})),o&&"line"===t&&s.forEach(((t,s)=>{const{id:r,points:l}=t,d=[];d.push(l[0]);const h=l[1].x-l[0].x,c=l[1].y-l[0].y,u=Math.sqrt(h*h+c*c),p=o/u;d.push({x:l[0].x+h*p,y:l[0].y+c*p});const b=gt(d,!!n),g=i.abs(d[0].x-d[1].x),_=i.abs(d[0].y-d[1].y),m=e.createPath({path:b,z:0,alpha:g>_?(l[1].x-l[0].x>0?-1:1)*i.pi/2:0,beta:g<_?-i.pi/2:0,anchor3d:g>_?[d[0].x,0]:[0,d[0].y],...i.isFunction(a)?i.merge({},yt.defaultAttributes.style,a(t,s)):a});m.name=`${this.name}-line`,m.id=this._getNodeId(`path-${r}`),this.add(m)})),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=mt(i,n,this.attribute),o=e.createPath({path:r,fill:a(t)});o.name=`${this.name}-region`,o.id=this._getNodeId(`region-${t}`),this.add(o)}}}_getNodeId(t){return`${this.id}-${t}`}}class xt 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({},xt.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]),o=[a.x-s.x,a.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=r,this._endAngle=l}render(){this.removeAllChild();const{points:t,startSymbol:s,endSymbol:a,lineStyle:n,state:r,visible:o=!0}=this.attribute;if(!o)return;t.length>1&&this.computeLineAngle();const l=this.renderSymbol(s,"start"),d=this.renderSymbol(a,"end");this.startSymbol=l,this.endSymbol=d;let h=t;if(s?.visible){const e=s?.clip?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(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)};h=[...h.slice(0,h.length-1),i]}const c=e.createLine({points:h,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,o=this._endAngle,{points:l,state:d}=this.attribute,h=l[0],c=l[l.length-1],{refX:u=0,refY:p=0,refAngle:b=0,style:g,symbolType:_,size:m=12}=t;let y,x;"start"===s?(y={x:h.x+(r?u*Math.cos(r)+p*Math.cos(r-Math.PI/2):0),y:h.y+(r?u*Math.sin(r)+p*Math.sin(r-Math.PI/2):0)},x=r+Math.PI/2):(y={x:c.x+(o?u*Math.cos(o)+p*Math.cos(o-Math.PI/2):0),y:c.y+(o?u*Math.sin(o)+p*Math.sin(o-Math.PI/2):0)},x=o+Math.PI/2),n=e.createSymbol({...y,symbolType:_,size:m,angle:a?x+b:0,strokeBoundsBuffer:0,...g}),n.name=`${s}-symbol`,n.id=this._getNodeId(`${s}-symbol`),i.isEmpty(d?.symbol)||(n.states=d.symbol),this.add(n)}return n}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var ft,vt;t.AXIS_ELEMENT_NAME=void 0,(ft=t.AXIS_ELEMENT_NAME||(t.AXIS_ELEMENT_NAME={})).innerView="inner-view",ft.axisContainer="axis-container",ft.labelContainer="axis-label-container",ft.tickContainer="axis-tick-container",ft.tick="axis-tick",ft.subTick="axis-sub-tick",ft.label="axis-label",ft.title="axis-title",ft.gridContainer="axis-grid-container",ft.grid="axis-grid",ft.gridRegion="axis-grid-region",ft.line="axis-line",ft.background="axis-background",t.AxisStateValue=void 0,(vt=t.AxisStateValue||(t.AxisStateValue={})).selected="selected",vt.selectedReverse="selected_reverse",vt.hover="hover",vt.hoverReverse="hover_reverse";const At={[t.AxisStateValue.selectedReverse]:{},[t.AxisStateValue.selected]:{},[t.AxisStateValue.hover]:{},[t.AxisStateValue.hoverReverse]:{}},St={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 Et 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),o(this.axisContainer,(t=>{t!==e&&t.name&&!i.isEmpty(t.states)&&t.addState(f.hoverReverse,!0)})),this._lastHover=e)};_onUnHover=t=>{this._lastHover&&(o(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 o(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),o(this.axisContainer,(t=>{t!==e&&t.name&&!i.isEmpty(t.states)&&t.addState(f.selectedReverse,!0)})),this._lastSelect=e)};_renderInner(s){const{title:a,label:n,tick:r,line:o,grid:l,items:d,panel:h}=this.attribute,c=e.createGroup({x:0,y:0,zIndex:1});if(c.name=t.AXIS_ELEMENT_NAME.axisContainer,c.id=this._getNodeId("container"),c.setMode(this.mode),this.axisContainer=c,s.add(c),o?.visible&&this.renderLine(c),d&&d.length){if(this.data=this._transformItems(d[0]),r?.visible&&this.renderTicks(c),n?.visible){const i=e.createGroup({x:0,y:0,pickable:!1});i.name=t.AXIS_ELEMENT_NAME.labelContainer,i.id=this._getNodeId("label-container"),this.axisLabelsContainer=i,c.add(i),d.forEach(((t,e)=>{const s=this.renderLabels(i,t,e).getChildren();this.handleLabelsOverlap(s,t,e,d.length)}))}l?.visible&&this.renderGrid(s)}if(a?.visible&&this.renderTitle(c),h&&h.visible){const s=c.AABBBounds,a=e.createRect({x:s.x1,y:s.y1,width:s.width(),height:s.height(),...h.style});a.name=t.AXIS_ELEMENT_NAME.background,a.id=this._getNodeId("background"),i.isEmpty(h.state)||(a.states=i.merge({},v,h.state)),c.insertBefore(a,c.firstChild)}}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 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(this.attribute.tick?.state))o.states=null;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))})),o.states=e}n.add(o)})),this.tickLineItems=a;const{subTick:r}=this.attribute;if(r?.visible){const s=this.getSubTickLineItems();s.length&&s.forEach(((s,o)=>{const l=e.createLine({...this._getTickLineAttribute("subTick",s,o,a)});if(l.name=t.AXIS_ELEMENT_NAME.subTick,l.id=this._getNodeId(`${o}`),i.isEmpty(r.state))l.states=null;else{const t=i.merge({},v,r.state);Object.keys(t).forEach((e=>{i.isFunction(t[e])&&(t[e]=t[e](s.value,o,s,a))})),l.states=t}n.add(l)})),this.subTickLineItems=s}}renderLabels(s,a,n){const{dataFilter:r}=this.attribute.label;r&&i.isFunction(r)&&(a=r(a,n));const o=this._transformItems(a),l=e.createGroup({x:0,y:0,pickable:!1});l.name=`${t.AXIS_ELEMENT_NAME.labelContainer}-layer-${n}`,l.id=this._getNodeId(`label-container-layer-${n}`),s.add(l);let d=0,h=0,c="center",u="middle";return o.forEach(((s,a)=>{const r=this._getLabelAttribute(s,a,o,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=null;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,o,n))})),p.states=t}l.add(p);const b=r.angle??0;d=Math.max(d,p.AABBBounds.width()),h=Math.max(h,p.AABBBounds.height()),b&&(d=Math.abs(d*Math.cos(b)),h=Math.abs(h*Math.sin(b))),c=r.textAlign,u=r.textBaseline})),this.axisLabelLayerSize[n]={width:d,height:h,textAlign:c,textBaseline:u},l}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:o}=t;let l=1;return e.length>=2&&(l=e[1].value-e[0].value),(o&&i.isFunction(o)?o(e):e).forEach((t=>{let e=t.point,o=t.value;if(!a){const i=t.value-l/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),o=i}const d=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const a=this.getVerticalVector(r,n,e);let l=0,h=0;i.abs(a[0])>i.abs(a[1])?l=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:o,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:l,beta:h})}else s.push({start:e,end:d,value:o,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],o=n[t+1];for(let t=0;t<i;t++){const n=(t+1)/(i+1),l=(1-n)*r.value+n*o.value,d=this.getTickCoord(l),h=this.getVerticalCoord(d,a,s);e.push({start:d,end:h,value:l,id:`sub-tick-${l}`})}}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(St,`${t}.style`),"tick"===t?n(r.rawValue,s,r,this.data):n(e.value,s,e,a)):n;const{start:o,end:l,anchor:d,alpha:h,beta:c}=e;return{points:[o,l],anchor:d,alpha:h,beta:c,...n}}_getLabelAttribute(t,e,s,a){const{space:n=4,inside:r=!1,formatMethod:o,...l}=this.attribute.label;let d=n,h=0;this.attribute.tick?.visible&&this.attribute.tick?.inside===r&&(h=this.attribute.tick?.length||4),this.attribute.subTick?.visible&&this.attribute.subTick?.inside===r&&(h=Math.max(h,this.attribute.subTick?.length||2)),d+=h;const c=this.getRelativeVector(t.point);a>0&&(0===c[1]?d+=(this.axisLabelLayerSize[a-1].height+i.get(this.attribute,"label.space",4))*a:d+=(this.axisLabelLayerSize[a-1].width+i.get(this.attribute,"label.space",4))*a);const u=this.getVerticalCoord(t.point,d,r),p=this.getVerticalVector(d,r,u),b=o?o(`${t.label}`,t,e,s,a):t.label;let{style:g}=l;return g=i.isFunction(g)?i.merge({},St.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 yt({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 kt={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&Bt(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Bt(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function wt(t,e){for(let i,s=1,a=t.length,n=t[0].AABBBounds;s<a;n=i,++s)if(Bt(n,i=t[s].AABBBounds,e))return!0}function Mt(t){const e=t.AABBBounds;return e.width()>1&&e.height()>1}function Lt(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 Tt(t,e){"bottom"!==t&&"top"!==t||function(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})}))}(t,e),"left"!==t&&"right"!==t||function(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})}))}(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,o=t.attribute.y,{x:(s-r)*Math.cos(n)+(a-o)*Math.sin(n)+r,y:(s-r)*Math.sin(n)+(o-a)*Math.cos(n)+o});var s,a,n,r,o;const l=i.x-e.centerX,d=i.y-e.centerY;e.x1+=l,e.x2+=l,e.y1+=d,e.y2+=d,e.centerX+=l,e.centerY+=d,t.rotatedBounds=e}))}(e)}class Ct extends Et{static defaultAttributes=St;constructor(t,e){super(i.merge({},Ct.defaultAttributes,t),e),"3d"===e&&this.setMode(e)}renderLine(e){const{start:s,end:a,line:n}=this.attribute,{startSymbol:r,endSymbol:o,style:l,breakRange:d,breakShape:h,breakShapeStyle:c,state:u,...p}=n,b={points:[s,a],startSymbol:r,endSymbol:o,lineStyle:l,...p};i.isEmpty(u)||(b.state={line:i.merge({},At,u),symbol:i.merge({},At,u)});const g=new xt(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:o,...l}=this.attribute.title;let d=.5;"start"===t?d=0:"end"===t&&(d=1);const{verticalFactor:h=1}=this.attribute,c=-1*h,u=this.getTickCoord(d),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 m=g+b+e,y=this.getVerticalCoord(u,m,!1),x=this.getVerticalVector(m,!1);let f,v,{angle:A}=l;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={...y,...l,textStyle:{textAlign:f,textBaseline:v,...s},state:i.isEmpty(o)?null:{text:o.text,shape:o.shape,panel:o.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=m,endAngle:r=y}=this.attribute.grid;s=function(t,e,s,a,n){const r=[],o=n-a;for(let n=0;n<e;n++){const l=a+n*o/e;r.push(i.polarToCartesian(t,s,l))}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:o=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<o;i++){const r=(i+1)/(o+1),l=(1-r)*a.value+r*n.value,d=this.getTickCoord(l);t.push({id:`sub-${s}-${i+1}`,points:this._getGridPoint(e,d),datum:{}})}s===i.length-2&&t.push({id:`sub-${s}-${o+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}handleLabelsOverlap(t,e,s,a){if(i.isEmpty(t))return;const{verticalLimitSize:n,label:r,title:o,line:l,tick:d,orient:h}=this.attribute,c=r.space??4;let u=n,p=0,b=0;const g=l?.visible?l.style.lineWidth??1:0,_=d?.visible?d.length??4:0;o?.visible&&(p=S(o.text,o.textStyle).height,b=o.space),u&&(u=(u-c-b-p-g-_)/a);const{layoutFunc:m,autoRotate:y,autoRotateAngle:x,autoLimit:f,limitEllipsis:v,autoHide:A,autoHideMethod:E,autoHideSeparation:k}=r;i.isFunction(m)?m(t,e,s,this):(y&&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)})),Tt(s,t),!Lt(t))break}}(t,{labelRotateAngle:x,orient:h}),f&&i.isValidNumber(u)&&u>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:u,ellipsis:v,orient:h}),A&&function(t,e){if(i.isEmpty(t))return;const s=t.filter(Mt);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,o=i.isFunction(n)?n:kt[n]||kt.parity;if(a.length>=3&&wt(a,r)){do{a=o(a,r)}while(a.length>=3&&wt(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:h,method:E,separation:k}))}}class Pt extends Et{static defaultAttributes=St;constructor(t){super(i.merge({},Pt.defaultAttributes,t))}renderLine(s){const{startAngle:a=m,endAngle:n=y,radius:r,center:o,innerRadius:l=0,line:d,inside:h=!1}=this.attribute;let c=r,u=l;h&&l>0&&(c=l,u=0);const p={...o,startAngle:a,endAngle:n,radius:c,innerRadius:u,...d?.style},b=e.createCircle(p);b.name=t.AXIS_ELEMENT_NAME.line,b.id=this._getNodeId("line"),i.isEmpty(d?.state)||(b.states=i.merge({},At,d.state)),s.add(b)}isInValidValue(t){const{startAngle:e=m,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=m,endAngle:s=y,center:a,radius:n,inside:r=!1,innerRadius:o=0}=this.attribute,l=e+(s-e)*t;return i.polarToCartesian(a,r&&o>0?o:n,l)}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:o,state:l,...d}=this.attribute.title;let h=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",h={x:t.x,y:t.y-p}):"end"===g&&(b="top",h={x:t.x,y:t.y+p});const _={...h,...d,textStyle:{textBaseline:b,textAlign:"center",...n},state:i.isEmpty(l)?null:{text:l.text,shape:l.shape,panel:l.background}},{angle:m}=d;return _.angle=m,r&&r.visible&&(_.shape={visible:!0,...r.style},r.space&&(_.space=r.space)),o&&o.visible&&(_.panel={visible:!0,...o.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,o=this.attribute?.tick?.alignWithLabel;for(let l=0;l<r;l++){const r=n[l],d=n[l+1];for(let n=0;n<i;n++){const l=(n+1)/(i+1),h=(1-l)*r.value+l*(d?d.value:o?1:r.value+t),c=this.getTickCoord(h),u=this.getVerticalCoord(c,a,s);e.push({start:c,end:u,value:h})}}}return e}getGridAttribute(t){let e,s=[];const{radius:a,innerRadius:n=0,startAngle:r=m,endAngle:o=y,center:l,grid:d}=this.attribute,{alignWithLabel:h=!0}=d||{},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(o-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-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(!h){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),o=(1-r)*s.value+r*(n?n.value:h?1:s.value+u),l=this.getTickCoord(o),d=this.getVerticalCoord(l,c,!0);t.push({id:`sub-${i}-${e+1}`,points:[l,d],datum:{}})}}Math.abs(o-r)%(2*Math.PI)==0&&t.push(t[0]),s=t}}return{...e,items:s,center:l}}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}handleLabelsOverlap(t,e,i,s){}}class It 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 o(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},o(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 Ht 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 zt 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 Vt;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(Vt||(Vt={}));const Dt={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 Rt extends n{name="dataZoom";static defaultAttributes=Dt;_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({},Rt.defaultAttributes,t));const{start:e,end:s,size:a,orient:n,showDetail:r,position:o,previewData:l,previewCallbackX:d,previewCallbackY:h,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=o,this._activeCache.lastPos=o,this._showText="auto"!==r&&r,l&&(this._previewData=l),i.isFunction(d)&&(this._previewCallbackX=d),i.isFunction(h)&&(this._previewCallbackY=h),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=Vt.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=Vt.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=Vt.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=Vt.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=Vt.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,o=(a[n]-this._activeCache.lastPos[n])/r;this._activeState&&(this._activeTag===Vt.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===Vt.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=Vt.endHandler):this.state.start=this.state.start+o:this._activeTag===Vt.endHandler&&(this.state.end+o<this.state.start?(this.state.end=this.state.start,this.state.start=this.state.end+o,this._activeTag=Vt.startHandler):this.state.end=this.state.end+o),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===Vt.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],o=Math.min(Math.max(Math.min(n,r)/s,0),1),l=Math.min(Math.max(Math.max(n,r)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}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===Vt.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===Vt.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:o,end:l}=this.state;this._startValue=this._statePointToData(o),this._endValue=this._statePointToData(l);const{position:d,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,i.merge({},a,{text:s?s(this._startValue):this._startValue,x:d.x+o*h,y:d.y+c/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+l*h,y:d.y+c/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+o*c,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+l*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${d}`))}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:o}=e,l=s?.background?.size??10;let d,h,c;s?.visible?this._isHorizontal?(d=r,h=o-l,c={x:t.x,y:t.y+l}):(d=r-l,h=o,c={x:t.x+("left"===i?l:0),y:t.y}):(d=r,h=o,c=t);const u=a?.size??(this._isHorizontal?h:d),p=n?.size??(this._isHorizontal?h:d);return a?.visible&&(this._isHorizontal?(d-=(u+p)/2,c={x:c.x+u/2,y:c.y}):(h-=(u+p)/2,c={x:c.x,y:c.y+u})),this._layoutAttrFromConfig={position:c,width:d,height:h},this._layoutAttrFromConfig}render(){this._layoutAttrFromConfig=null;const{orient:t,backgroundStyle:e,backgroundChartStyle:i,selectedBackgroundStyle:s,selectedBackgroundChartStyle:a,middleHandlerStyle:n,startHandlerStyle:r,endHandlerStyle:o,brushSelect:l}=this.attribute,{start:d,end:h}=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:l?"crosshair":"auto",...e},"rect"),i?.line?.visible&&this.setPreviewAttributes("line",b),i?.area?.visible&&this.setPreviewAttributes("area",b),l&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=b.createOrUpdateChild("selectedBackground",{x:c.x+d*u,y:c.y,width:(h-d)*u,height:p,cursor:l?"crosshair":"move",...s},"rect"):this._selectedBackground=b.createOrUpdateChild("selectedBackground",{x:c.x,y:c.y+d*p,width:u,height:(h-d)*p,cursor:l?"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+d*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+h*u,y:c.y+p/2,size:p,angle:0,symbolType:o?.symbolType??"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",...o},"symbol"),n?.visible&&(this._middleHandlerRect=b.createOrUpdateChild("middleHandlerRect",{x:c.x+d*u,y:c.y-(n?.background?.size||10),width:(h-d)*u,height:n?.background?.size||10,...n?.background?.style},"rect"),this._middleHandlerSymbol=b.createOrUpdateChild("middleHandlerSymbol",{x:c.x+(d+h)/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+d*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+d*p,width:n?.background?.size||10,height:(h-d)*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+(d+h)/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+h*p,size:u,angle:Math.PI/180*90,symbolType:o?.symbolType??"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0,...o},"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:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+s*r:n.x,y:this._isHorizontal?n.y:n.y+s*o,width:this._isHorizontal?(a-s)*r:r,height:this._isHorizontal?o:(a-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+s*r:n.x),y:-(this._isHorizontal?n.y:n.y+s*o),width:this._isHorizontal?(a-s)*r:r,height:this._isHorizontal?o:(a-s)*o,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 Ot,Nt,$t;t.IMarkLineLabelPosition=void 0,(Ot=t.IMarkLineLabelPosition||(t.IMarkLineLabelPosition={})).start="start",Ot.middle="middle",Ot.end="end",Ot.insideStartTop="insideStartTop",Ot.insideStartBottom="insideStartBottom",Ot.insideMiddleTop="insideMiddleTop",Ot.insideMiddleBottom="insideMiddleBottom",Ot.insideEndTop="insideEndTop",Ot.insideEndBottom="insideEndBottom",t.IMarkAreaLabelPosition=void 0,(Nt=t.IMarkAreaLabelPosition||(t.IMarkAreaLabelPosition={})).left="left",Nt.right="right",Nt.top="top",Nt.bottom="bottom",Nt.middle="middle",Nt.insideLeft="insideLeft",Nt.insideRight="insideRight",Nt.insideTop="insideTop",Nt.insideBottom="insideBottom",t.IMarkPointItemPosition=void 0,($t=t.IMarkPointItemPosition||(t.IMarkPointItemPosition={})).top="top",$t.bottom="bottom",$t.middle="middle",$t.insideTop="insideTop",$t.insideBottom="insideBottom",$t.insideMiddle="insideMiddle";class Ut 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.updateMarker();else{const t=e.createGroup({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const Ft={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]}},Gt={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"}},Wt={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}},Xt={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"}},Yt={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}}},Zt={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 jt extends Ut{static defaultAttributes=Ft;_line;constructor(t){super(i.merge({},jt.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:{...Gt[i],...e.textStyle}})}initMarker(t){const{points:e,startSymbol:i,endSymbol:s,label:a,lineStyle:n}=this.attribute,r=new xt({points:e,startSymbol:i,endSymbol:s,lineStyle:n});r.name="mark-line-line",this._line=r,t.add(r);const o=new E({...a});o.name="mark-line-label",this._label=o,t.add(o),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 qt extends Ut{static defaultAttributes=Wt;_area;constructor(t){super(i.merge({},qt.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:{...Xt[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 Jt extends Ut{static defaultAttributes=Yt;_item;_line;_decorativeLine;constructor(t){super(i.merge({},Jt.defaultAttributes,t))}setLabelPos(){}setItemAttributes(e,i,s,a){const{autoRotate:n=!0,refX:r=0,refY:o=0,refAngle:l=0,textStyle:d,richTextStyle:h,imageStyle:c,position:u=t.IMarkPointItemPosition.middle}=i,p=this._line?.getEndAngle()||0,b=r*Math.cos(p)+o*Math.cos(p-Math.PI/2),g=r*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===a?e?.setAttributes({...d,textStyle:{...Zt[i?.position||"end"],...d?.textStyle}}):"richText"===a?e?.setAttributes({dx:this.getItemDx(e,u,h)+(h?.dx||0),dy:this.getItemDy(e,u,h)+(h?.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+l})}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:o}=t;let l;return"symbol"===s?l=e.createSymbol({...i,...a}):"text"===s?l=new E({...i}):"richText"===s?l=e.createRichText({...i,...n}):"image"===s?l=e.createImage({...i,...r}):"custom"===s&&o&&(l=o()),this.setItemAttributes(l,t,i,s),l}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,o=this.getItemLineAttr(t,e,i);this._line?.setAttributes({points:o,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:o}=this.getDecorativeLineAttr(t,e);this._decorativeLine?.setAttributes({points:[{x:e.x+a,y:e.y+n},{x:e.x+r,y:e.y+o}],...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 xt({points:[]});r.name="mark-point-line",this._line=r,t.add(r);const o=e.createLine({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(s,i,n,s?.visible),this.setDecorativeLineAttr(s,n,s?.decorativeLine?.visible);const l=this.initItem(a,n);this._item=l,t.add(l)}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 Kt={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class Qt extends n{name="pager";_current=1;getCurrent(){return this._current}_total;preHandler;nextHandler;text;static defaultAttributes={handler:Kt,textStyle:{fill:"rgb(51, 51, 51)",fontSize:12}};constructor(t){super(i.merge({},Qt.defaultAttributes,t))}render(){this._reset();const{layout:t="horizontal",handler:s=Kt,total:a,defaultCurrent:n=1,textStyle:r,padding:o=0}=this.attribute;this._current=n;const l=i.normalizePadding(o),d="horizontal"===t,h=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=d?"triangleLeft":"triangleUp"),_||(_=d?"triangleRight":"triangleDown");const m=e.createSymbol({strokeBoundsBuffer:0,pickMode:"imprecise",...c,x:0,y:0,symbolType:g,size:u});m.states=b,m.name="preHandler",this.preHandler=m,h.add(m);const{width:y,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:d?f/2+p+y/2:0,y:d?0:v/2+p+x/2,text:`${n}/${a}`,textAlign:"center",textBaseline:"middle",lineHeight:r?.fontSize,...r});this.text=A,h.add(A);const E=e.createSymbol({strokeBoundsBuffer:0,pickMode:"imprecise",...c,x:d?f+2*p+y:0,y:d?0:v+2*p+x,symbolType:_,size:u});E.name="nextHandler",E.states=b,this.nextHandler=E,h.add(E),1===this._total?(m.addState("disable"),E.addState("disable")):1===this._current?m.addState("disable"):this._current===a&&E.addState("disable");const k=h.AABBBounds,B=k.width(),w=k.height();h.translateTo(0-k.x1+l[3],0-k.y1+l[0]),this.add(h),this.attribute.width=B+l[1]+l[3],this.attribute.height=w+l[0]+l[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 te=16,ee=8,ie=12,se=12;var ae,ne,re;t.LegendStateValue=void 0,(ae=t.LegendStateValue||(t.LegendStateValue={})).selected="selected",ae.unSelected="unSelected",ae.selectedHover="selectedHover",ae.unSelectedHover="unSelectedHover",ae.focus="focus",t.LegendEvent=void 0,(ne=t.LegendEvent||(t.LegendEvent={})).legendItemHover="legendItemHover",ne.legendItemUnHover="legendItemUnHover",ne.legendItemClick="legendItemClick",t.LEGEND_ELEMENT_NAME=void 0,(re=t.LEGEND_ELEMENT_NAME||(t.LEGEND_ELEMENT_NAME={})).innerView="innerView",re.title="legendTitle",re.item="legendItem",re.itemShape="legendItemShape",re.itemLabel="legendItemLabel",re.itemValue="legendItemValue",re.focus="legendItemFocus";class oe 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),o=e.createGroup({x:r[3],y:r[0],pickable:s,childrenPickable:s});o.name=t.LEGEND_ELEMENT_NAME.innerView,this.add(o),this._innerView=o,a?.visible&&this._renderTitle(a),this._renderContent(),this._adjustLayout(),s&&this._bindEvents();const l=this._innerView.AABBBounds;this.attribute.width=l.width()+r[1]+r[3],this.attribute.height=l.height()+r[0]+r[2]}_renderTitle(e){const{text:s="",textStyle:a,padding:n=0,background:r,minWidth:o,maxWidth:l,shape:d}=e,h={x:0,y:0,text:s,textStyle:a,padding:i.normalizePadding(n),minWidth:o,maxWidth:l};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 c=new E(h);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 le={[t.LegendStateValue.focus]:{},[t.LegendStateValue.selected]:{},[t.LegendStateValue.selectedHover]:{},[t.LegendStateValue.unSelected]:{},[t.LegendStateValue.unSelectedHover]:{}};class de extends oe{name="discreteLegend";_itemsContainer=null;_itemWidthByUser;_itemHeightByUser=void 0;_itemHeight=0;_itemMaxWidth=0;_pager;static defaultAttributes={layout:"horizontal",title:{align:"start",space:ie,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:te,spaceRow:ee,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:se,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};constructor(t){super(i.merge({},de.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 o=s;a&&(o=s?.reverse());const l=e.createGroup({x:0,y:0});this._itemsContainer=l;const{layout:d,maxWidth:h,maxHeight:c,defaultSelected:u=[],autoPage:p}=this.attribute,b="horizontal"===d,{spaceCol:g=te,spaceRow:_=ee,maxWidth:m,width:y,height:x}=t;i.isValid(m)?i.isValid(y)?this._itemWidthByUser=Math.min(m,y):this._itemWidthByUser=m:i.isValid(y)&&(this._itemWidthByUser=y),i.isValid(x)&&(this._itemHeightByUser=x);let f=!1,v=0,A=0,S=0,E=1,k=1;o.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,o),a=s.attribute.width,d=s.attribute.height;this._itemHeight=Math.max(this._itemHeight,d),v=Math.max(a,v),this._itemMaxWidth=Math.max(a,this._itemMaxWidth),b?(E=r,i.isValid(h)&&(a>=h?(f=!0,e>0&&(A=0,S+=d+_,k+=1)):h<A+a&&(f=!0,A=0,S+=d+_,k+=1)),e>0&&s.setAttributes({x:A,y:S}),A+=g+a):(E=n,i.isValid(c)&&c<S+d&&(f=!0,S=0,A+=v+g,v=0,k+=1),e>0&&s.setAttributes({x:A,y:S}),S+=_+d),l.add(s)}));let B=!1;f&&p&&k>E&&(B=this._renderPager(b)),B||(l.setAttribute("y",this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",8):0),this._innerView.add(l))}_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:o,label:l,value:d,shape:h}=s,{padding:c=0,focus:u,focusIconStyle:p={}}=this.attribute.item;let{shape:b={},label:g={},value:_={},background:m={}}=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),m=this._handleStyle(m,s,a,n,r);const y=i.normalizePadding(c);let x;!1===m.visible?(x=e.createGroup({x:0,y:0,cursor:(m?.style).cursor}),this._appendDataToShape(x,t.LEGEND_ELEMENT_NAME.item,s,x)):(x=e.createGroup({x:0,y:0,...m?.style}),this._appendDataToShape(x,t.LEGEND_ELEMENT_NAME.item,s,x,m?.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,...h,...b.style});let k;Object.keys(b.state||{}).forEach((t=>{const e=b.state[t].fill||b.state[t].stroke;h.fill&&i.isNil(b.state[t].fill)&&e&&(b.state[t].fill=e),h.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 B=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:y}),this._appendDataToShape(k,t.LEGEND_ELEMENT_NAME.focus,s,x),B=a}const w=e.createText({x:A/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(g?.style).fontSize,...g?.style,text:g.formatMethod?g.formatMethod(l,s,n):l});this._appendDataToShape(w,t.LEGEND_ELEMENT_NAME.itemLabel,s,x,g?.state),w.addState(a?t.LegendStateValue.selected:t.LegendStateValue.unSelected),f.add(w);const M=i.get(g,"space",8);if(v+=A/2+S+w.AABBBounds.width()+M,i.isValid(d)){const r=i.get(_,"space",u?8:0),o=e.createText({x:v+M,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(_?.style).fontSize,..._?.style,text:_.formatMethod?_.formatMethod(d,s,n):d});this._appendDataToShape(o,t.LEGEND_ELEMENT_NAME.itemValue,s,x,_?.state),o.addState(a?t.LegendStateValue.selected:t.LegendStateValue.unSelected),this._itemWidthByUser&&(o.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-A-S-w.AABBBounds.width()-M-B-r),_.alignRight&&o.setAttributes({textAlign:"right",x:this._itemWidthByUser-A/2-y[1]-y[3]-B-r})),v=o.AABBBounds.x2+r,f.add(o)}else this._itemWidthByUser&&w.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-A-S-B);k&&(k.setAttribute("x",v),f.add(k));const L=f.AABBBounds,T=L.width(),C=L.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 x.attribute.width=P,x.attribute.height=I,f.translateTo(-L.x1+y[3],-L.y1+y[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:o=2,item:l={},pager:d={}}=this.attribute,{spaceCol:h=te,spaceRow:c=ee}=l,u=this._itemsContainer,{animation:p=!0,animationDuration:b=450,animationEasing:g="quadIn",space:_=se,...m}=d;let y,x=0,f=0,v=0,A=0,S=1;if(t){if(y=new Qt({layout:1===o?"horizontal":"vertical",total:99,...i.merge({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},m)}),this._pager=y,this._innerView.add(y),x=(o-1)*c+this._itemHeight*o,f=a-y.AABBBounds.width()-_,f<=0)return this._innerView.removeChild(y),!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+=h+i})),y.setAttributes({total:Math.ceil(S/o),x:f,y:s+x/2-y.AABBBounds.height()/2})}else{if(y=new Qt({layout:"horizontal",total:99,...m}),this._pager=y,this._innerView.add(y),f=this._itemMaxWidth*r+(r-1)*h,x=n-y.AABBBounds.height()-_-s,x<=0)return this._innerView.removeChild(y),!1;u.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;x<A+i&&(A=0,v+=this._itemMaxWidth+h,S+=1),e>0&&t.setAttributes({x:v,y:A}),A+=c+i})),y.setAttributes({total:Math.ceil(S/r),x:(f-y.AABBBounds.width())/2,y:n-y.AABBBounds.height()})}d.defaultCurrent>1&&(t?u.setAttribute("y",-(d.defaultCurrent-1)*(x+c)):u.setAttribute("x",-(d.defaultCurrent-1)*(f+h)));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+h)},b,g):t?u.setAttribute("y",-(i-1)*(x+c)):u.setAttribute("x",-(i-1)*(f+h))};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({},le,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((o=>{t.state[o]&&i.isFunction(t.state[o])&&(r.state[o]=t.state[o](e,s,a,n))})),r}}var he;function ce(t){return i.isArray(t)?t:[t,t]}function ue(t){return t?"ew-resize":"ns-resize"}t.SLIDER_ELEMENT_NAME=void 0,(he=t.SLIDER_ELEMENT_NAME||(t.SLIDER_ELEMENT_NAME={})).innerView="innerView",he.railContainer="sliderRailContainer",he.rail="sliderRail",he.startText="sliderStartText",he.endText="sliderEndText",he.startHandler="sliderStartHandler",he.startHandlerText="startHandlerText",he.endHandler="sliderEndHandler",he.endHandlerText="sliderEndHandlerText",he.track="sliderTrack",he.trackContainer="sliderTrackContainer";class pe 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({},pe.defaultAttributes,t))}setValue(t){const[e,s]=i.array(t),{layout:a,railWidth:n,railHeight:r,min:o,max:l}=this.attribute,{startHandler:d,endHandler:h}=this._getHandlers(),c="vertical"===a?r:n,u=(e-o)/(l-o)*c;if(d&&this._updateHandler(d,u,e),h){const t=(s-o)/(l-o)*c;this._updateHandler(h,t,s)}this._updateTrack()}render(){this.removeAllChild();const{layout:s="horizontal",railWidth:a,railHeight:n,startText:r,endText:o,min:l,max:d,showHandler:h=!0}=this.attribute;let{value:c}=this.attribute;i.isNil(c)&&(c=[l,d]),this._currentValue={startValue:ce(c)[0],endValue:ce(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 m=e.createGroup({x:0,y:0});let y;if(m.name=t.SLIDER_ELEMENT_NAME.railContainer,this._railContainer=m,_.add(m),this._renderRail(m),g+=u?a:n,o&&o.visible){const s=i.isValid(o.space)?o.space:0;y=e.createText({x:u?g+s:a/2,y:u?n/2:g+s,textAlign:u?"start":"center",textBaseline:u?"middle":"top",text:o.text,lineHeight:o.style?.fontSize,...o.style}),y.name=t.SLIDER_ELEMENT_NAME.endText,p.add(y)}this._renderTrack(m),h&&(this._renderHandlers(_),this._bindEvents())}_renderRail(i){const{railWidth:s,railHeight:a,railStyle:n,slidable:r}=this.attribute;let o="default";!1!==r&&(o="pointer");const l=e.createRect({x:0,y:0,width:s,height:a,cursor:o,...n});return l.name=t.SLIDER_ELEMENT_NAME.rail,i.add(l),this._rail=l,l}_renderHandlers(e){const{range:s,min:a,max:n,handlerSize:r=14,handlerStyle:o,handlerText:l,railHeight:d,railWidth:h,slidable:c}=this.attribute;let{value:u}=this.attribute;i.isNil(u)&&(u=[a,n]);const p=l&&l.visible,b=this._isHorizontal,g=b?h:d,[_,m]=ce(u),y=(_-a)/(n-a)*g,x=this._renderHandler({x:b?y:h/2,y:b?d/2:y,size:r,strokeBoundsBuffer:0,cursor:!1===c?"default":ue(b),...o});if(x.name=t.SLIDER_ELEMENT_NAME.startHandler,this._startHandler=x,e.add(x),this._currentValue.startPos=y,p){const i=this._renderHandlerText(_);i.name=t.SLIDER_ELEMENT_NAME.startHandlerText,e.add(i),this._startHandlerText=i}if(s){const i=(m-a)/(n-a)*g,s=this._renderHandler({x:b?i:h/2,y:b?d/2:i,size:r,strokeBoundsBuffer:0,cursor:!1===c?"default":ue(b),...o});if(s.name=t.SLIDER_ELEMENT_NAME.endHandler,this._endHandler=s,e.add(s),this._currentValue.endPos=i,p){const i=this._renderHandlerText(m);i.name=t.SLIDER_ELEMENT_NAME.endHandlerText,e.add(i),this._endHandlerText=i}}}_renderTrack(s){const{range:a,min:n,max:r,railHeight:o,railWidth:l,trackStyle:d,railStyle:h,slidable:c}=this.attribute;let{value:u}=this.attribute;i.isNil(u)&&(u=[n,r]);const p=this._isHorizontal,b=p?l:o;let[g,_]=ce(u);a||(g=n);const m=e.createGroup({x:0,y:0,width:l,height:o,cornerRadius:h?.cornerRadius,clip:!0,pickable:!1});m.name=t.SLIDER_ELEMENT_NAME.trackContainer;const y=i.isObject(a)&&!0===a.draggableTrack;let x;x=!1===c?"default":!1===a||!1===y?"pointer":ue(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:l,height:p?o:f,cursor:x,...d});v.name=t.SLIDER_ELEMENT_NAME.track,this._track=v,m.add(v),s.add(m)}_renderHandler(t){return e.createSymbol(t)}_renderHandlerText(t){const{align:i,min:s,max:a,handlerSize:n=14,handlerText:r={},railHeight:o,railWidth:l,slidable:d}=this.attribute,h=this._isHorizontal,c=(t-s)/(a-s)*(h?l:o),u=r.space??4,p={text:r?.formatter?r.formatter(t):t.toFixed(r?.precision??0),lineHeight:r.style?.lineHeight,cursor:!1===d?"default":ue(h),...r.style};h?"top"===i?(p.textBaseline="bottom",p.textAlign="center",p.x=c,p.y=(o-n)/2-u):(p.textBaseline="top",p.textAlign="center",p.x=c,p.y=(o+n)/2+u):"left"===i?(p.textBaseline="middle",p.textAlign="end",p.x=(l-n)/2-u,p.y=c):(p.textBaseline="middle",p.textAlign="start",p.x=(l+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,o,l,d=0;this._isHorizontal?(r=t.clientX,d=r-this._prePos,o=this._currentHandler?.attribute.x,l=e):(r=t.clientY,d=r-this._prePos,o=this._currentHandler?.attribute.y,l=s);const h=i.clamp(o+d,0,l),c=h/l*(n-a)+a;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,h,c):this._updateHandler(this._currentHandler,h,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:o}=this._getHandlers();let l,d,h;this._isHorizontal?(l=t.clientX,d=this._track.attribute.width,h=e):(l=t.clientY,d=this._track.attribute.height,h=s);const c=l-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=i.clamp(t+c,0,h-d),s=e/h*(n-a)+a;this._updateHandler(r,e,s)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=i.clamp(t+c,d,h),s=e/h*(n-a)+a;this._updateHandler(o,e,s),this._track.setAttributes(this._isHorizontal?{x:Math.min(r?.attribute.x,o?.attribute.x),width:Math.abs(r?.attribute.x-o?.attribute.x)}:{y:Math.min(r?.attribute.y,o?.attribute.y),height:Math.abs(r?.attribute.y-o?.attribute.y)})}this._prePos=l,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,o=this._endHandler;let l,d,h,c;this._isHorizontal?(l=t.viewX-this._rail.globalAABBBounds.x1,d=r?.attribute.x,h=o?.attribute.x,c=e):(l=t.viewY-this._rail.globalAABBBounds.y1,d=r?.attribute.y,h=o?.attribute.y,c=s);const u=l/c*(n-a)+a;if(i.isValid(h)){const t=Math.abs(l-d)>Math.abs(l-h)?o:r;this._updateHandler(t,l,u)}else this._updateHandler(r,l,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 be extends oe{name="colorLegend";static defaultAttributes={layout:"horizontal",title:{align:"start",space:ie,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({},be.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:o,value:l,railWidth:d,railHeight:h,showHandler:c=!0,handlerSize:u,handlerStyle:p,railStyle:b,trackStyle:g,startText:_,endText:m,handlerText:y,showTooltip:x,tooltip:f}=this.attribute,v=[],A=(o-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 pe({x:0,y:0,range:{draggableTrack:!0},slidable:e,layout:a,align:n,min:r,max:o,value:l,railWidth:d,railHeight:h,showHandler:c,handlerSize:u,handlerStyle:p,railStyle:b,trackStyle:{fill:this._color,...g},startText:_,endText:m,handlerText:y,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",ie):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:o,endValue:l,startPos:d,endPos:h}=this._slider.currentValue,c=this._colorScale.scale(o),u=this._colorScale.scale(l);a?.setAttribute("fill",c),n?.setAttribute("fill",u);const p="horizontal"===t?i:s;if(Math.abs(d-h)!==p&&e&&e.length>1){const t=this._color.stops,e=Math.min(d,h),i=Math.max(d,h),s=e/p,a=i/p,n=a-s,c=t.filter((t=>t.offset>s&&t.offset<a)),u=Math.min(o,l),b=Math.max(o,l),g=this._colorScale.scale(u),_=this._colorScale.scale(b),m=[{offset:0,color:g}];c.forEach((t=>{m.push({offset:(t.offset-s)/n,color:t.color})})),m.push({offset:1,color:_}),r.setAttribute("fill",{...this._color,stops:m})}}}function ge(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 _e extends oe{name="sizeLegend";static defaultAttributes={layout:"horizontal",title:{align:"start",space:ie,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({},_e.defaultAttributes,t))}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:s,align:a,min:n,max:r,value:o,railWidth:l,railHeight:d,showHandler:h=!0,handlerSize:c,handlerStyle:u,railStyle:p,trackStyle:b,startText:g,endText:_,handlerText:m,showTooltip:y,tooltip:x,sizeBackground:f}=this.attribute,v=e.createGroup({x:0,y:0});this._innerView.add(v);const A=new pe({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:s,align:a,min:n,max:r,value:o,railWidth:l,railHeight:d,showHandler:h,handlerSize:c,handlerStyle:{symbolType:ge(a),...u},railStyle:p,trackStyle:b,startText:g,endText:_,handlerText:m,showTooltip:y,tooltip:x});v.add(A);let S,E=0;const k=12;"horizontal"===s?"top"===a?(S=`M0,0L${l},0L${l},12Z`,E=d):(S=`M0,12L${l},12L${l},0Z`,A.setAttribute("y",k)):"left"===a?S=`M${l},0L${l},0L${l+k},${d}L${l},${d}Z`:(S=`M0,${d}L12,${d}L12,0Z`,A.setAttribute("x",k));const B=e.createPath({x:0,y:E,path:S,...f,zIndex:0});v.add(B);const w=this._title?this._title.AABBBounds.height()+i.get(this.attribute,"title.space",ie):0;v.translate(0-v.AABBBounds.x1,w-v.AABBBounds.y1),this._slider=A}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}_onSliderChange=t=>{this.dispatchEvent(t)}}class me 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({},me.defaultAttributes,t))}render(){const{text:t,textStyle:e,subtext:s,subtextStyle:a,width:n,height:r,minWidth:o,maxWidth:l,minHeight:d,maxHeight:h,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,m=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 y=this._subTitle?this._subTitle?.AABBBounds.height():0,x=this._subTitle?this._subTitle?.AABBBounds.width():0;let f=Math.max(m,x),v=_+(a?.height??y);if(i.isValid(n)&&(f=n,this._mainTitle?.setAttribute("maxLineWidth",n),this._subTitle?.setAttribute("maxLineWidth",n)),i.isValid(r)&&(v=r),i.isValid(o)&&f<o&&(f=o),i.isValid(l)&&(this._mainTitle?.setAttribute("maxLineWidth",l),this._subTitle?.setAttribute("maxLineWidth",l),this._mainTitle?.setAttribute("maxWidth",l),this._subTitle?.setAttribute("maxWidth",l),f>l&&(f=l)),i.isValid(d)&&v<d&&(v=d),i.isValid(h)&&(this._mainTitle?.setAttribute("maxHeight",h),this._subTitle?.setAttribute("maxHeight",h-_),v>h&&(v=h)),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??m;"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 ye={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 xe=(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 o=(i+s)/2,l=n+a,d=r+a;t.round&&(i=Math.round(i),s=Math.round(s),n=Math.round(n),r=Math.round(r),l=Math.round(l),d=Math.round(d),o=Math.round(o));const h=Math.abs(s-i)>1e-6,c=t.endArrow&&h?`L${s},${r-a/2}L${s+a},${(r+d)/2}L${s},${d+a/2}`:"",u=t.startArrow&&h?`L${i},${l+a/2}L${i-a},${(n+l)/2}L${i},${n-a/2}`:"";return!1===t.isSmooth?`M${i},${n}L${s},${r}${c}L${s},${d}L${i},${l}${u}Z`:`M${i},${n}\n C${o},${n},${o},${r},${s},${r}\n ${c}\n L${s},${d}\n C${o},${d},${o},${l},${i},${l}\n ${u}\n Z`},fe=(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 o=(i+s)/2,l=a+r,d=n+r;t.round&&(i=Math.round(i),s=Math.round(s),a=Math.round(a),n=Math.round(n),l=Math.round(l),d=Math.round(d),o=Math.round(o));const h=Math.abs(s-i)>1e-6,c=t.endArrow&&h?`L${n-r/2},${s}L${(n+d)/2},${s+r}L${d+r/2},${s}`:"",u=t.startArrow&&h?`L${l+r/2},${i}L${(l+a)/2},${i-r}L${a-r/2},${i}`:"";return!1===t.isSmooth?`M${a},${i}L${n},${s}${c}L${d},${s}L${l},${i}${u}Z`:`M${a},${i}\n C${a},${o},${n},${o},${n},${s}\n ${c}\n L${d},${s}\n C${d},${o},${l},${o},${l},${i}\n ${u}\n Z`};class ve extends n{static defaultAttributes={direction:"horizontal",align:"start"};_container;_backPath;_frontPath;constructor(t){super(i.merge({},ve.defaultAttributes,t))}render(){const{direction:t="horizontal"}=this.attribute,e="vertical"===t?fe:xe,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 Ae extends e.Symbol{constructor(t){super(t)}}var Se,Ee;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(Se||(Se={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(Ee||(Ee={}));class ke extends n{static defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"};static defaultAttributes={visible:!0,[Ee.Start]:{},[Ee.Pause]:{},[Ee.Backward]:{},[Ee.Forward]:{}};_isPaused=!0;_playController;_forwardController;_backwardController;_layout;_startAttr;_pauseAttr;_forwardAttr;_backwardAttr;constructor(t){super(i.merge({},ke.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",...ke.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",...ke.defaultControllerAttr,...this.attribute.pause.style}},this._forwardAttr={style:{...ke.defaultControllerAttr,...this.attribute.forward.style}},this._backwardAttr={style:{...ke.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 Ae({...this._startAttr.style}),this.add(this._playController))};_initBackward=()=>{i.isNil(this._backwardController)&&(this._backwardController=new Ae({...this._backwardAttr.style}),this.add(this._backwardController))};_initForward=()=>{i.isNil(this._forwardController)&&(this._forwardController=new Ae({...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(Se.OnPlay);this.dispatchEvent(t)};pause=()=>{const t=this._createCustomEvent(Se.OnPause);this.dispatchEvent(t)};forward=()=>{const t=this._createCustomEvent(Se.OnForward);this.dispatchEvent(t)};backward=()=>{const t=this._createCustomEvent(Se.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 Be={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},we=[200,10];var Me,Le;t.DirectionEnum=void 0,(Me=t.DirectionEnum||(t.DirectionEnum={})).Default="default",Me.Reverse="reverse",t.PlayerEventEnum=void 0,(Le=t.PlayerEventEnum||(t.PlayerEventEnum={})).OnChange="onChange",Le.OnPlay="onPlay",Le.OnPause="onPause",Le.OnBackward="onBackward",Le.OnForward="onForward",Le.OnEnd="onEnd";const Te=({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}),Ce=({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}),Pe=t=>"top"===t||"bottom"===t;class Ie 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:{...Be,key:"start",position:"start",space:0},pause:{...Be,key:"pause",position:"start"},forward:{...Be,key:"forward",position:"end"},backward:{...Be,key:"backward",position:"start"}}};_slider;_controller;_data=[];_minIndex;_maxIndex;_railStyle;_trackStyle;_handlerStyle;_start;_pause;_forward;_backward;_size;_orient;_layoutInfo={};constructor(t){super(i.merge({},Ie.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=(Pe(this._orient)?this._railStyle.height:this._railStyle.width)??we[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=(Pe(this._orient)?this._size?.width:this._size?.height)-n,o=r-this.attribute.slider.space,l=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:Pe(this._orient)?t+a:(this._size.width-r)/2,y:Pe(this._orient)?(this._size.height-r)/2:t+a},t+a+r}),0);this._layoutInfo.slider={...this._layoutInfo.slider,size:o,x:Pe(this._orient)?l+this.attribute.slider.space:(this._size.width-a)/2,y:Pe(this._orient)?(this._size.height-a)/2:l+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:Pe(this._orient)?t+a:(this._size.width-r)/2,y:Pe(this._orient)?(this._size.height-r)/2:t+a},t+a+r}),l+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(Pe(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=this._railStyle.height??we[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??we[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 pe(t),this.add(this._slider)};_updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return Pe(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 ke(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 He;t.IOperateType=void 0,(He=t.IOperateType||(t.IOperateType={})).drawStart="drawStart",He.drawEnd="drawEnd",He.drawing="drawing",He.moving="moving",He.moveStart="moveStart",He.moveEnd="moveEnd",He.brushClear="brushClear";const ze={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}},Ve=5,De={debounce:i.debounce,throttle:i.throttle};class Re extends n{name="brush";static defaultAttributes=ze;_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({},Re.defaultAttributes,t))}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",De[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,o=a.map((t=>({x:t.x+n,y:t.y+r})));if(i.polygonContainPoint(o,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:o,x2:l,y1:d,y2:h}=this._operatingMask.globalAABBBounds,c=n-o,u=r-l,p=s-d,b=a-h;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:o=Ve}=this.attribute;if(this._isDrawedBeforeEnd=!!(Math.abs(a-s)>o||Math.abs(n-r)>o),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 l=this._computeMaskPoints();this._operatingMask.setAttribute("points",l),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,o=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:o}),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 Oe=(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)})},Ne=t=>{const{width:e,height:s,wordBreak:a="break-word",textAlign:n,textBaseline:r,text:o}=t;return{width:e,height:s,wordBreak:a,textAlign:n,textBaseline:r,singleLine:!1,textConfig:i.array(o).map((e=>({...t,text:e})))}},$e={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},Ue=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"],Fe="tooltip-title",Ge="tooltip-content",We="shape",Xe="value";class Ye extends n{name="tooltip";_tooltipPanel;_tooltipTitleContainer;_tooltipTitleSymbol;_tooltipTitle;_tooltipContent;static defaultAttributes=$e;constructor(t){super(i.merge({},Ye.defaultAttributes,t))}render(){const{visible:t,content:e,panel:s,keyWidth:a,valueWidth:n,hasContentShape:r,autoCalculatePosition:o,autoMeasure:d}=this.attribute;if(!t)return void this.hideAll();d&&Ye.measureTooltip(this.attribute),o&&Ye.calculateTooltipPosition(this.attribute);const h=i.normalizePadding(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",{visible:!0,...s},"rect"),this._tooltipTitleContainer=this.createOrUpdateChild(Fe,{visible:!0,x:h[3],y:h[0]},"group");const c=Ye.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild(`${Fe}-${We}`,i.merge({symbolType:"circle"},c.shape,{visible:l(c)&&l(c.shape)}),"symbol"),c.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild(`${Fe}-${Xe}`,{visible:l(c)&&l(c.value),...Ne(c.value)},"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild(`${Fe}-${Xe}`,{text:"",visible:l(c)&&l(c.value),...c.value},"text");const u=l(c.shape)?c.shape.size+c.shape.spacing:0,{textAlign:p,textBaseline:b}=c.value,g=s.width-h[3]-h[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 _=l(c)?c.height+c.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild(Ge,{visible:!0},"group"),this._tooltipContent.removeAllChild(),e?.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+_);let t=0;e.forEach(((e,s)=>{const o=Ye.getContentAttr(this.attribute,s);if(!l(o))return;const d=`${Ge}-${s}`,h=this._tooltipContent.createOrUpdateChild(d,{visible:!0,x:0,y:t},"group");let c=0;if(l(o.shape)&&h.createOrUpdateChild(`${d}-${We}`,{visible:!0,x:o.shape.size/2,y:o.shape.size/2+((o.key.lineHeight??o.key.fontSize)-o.shape.size)/2,...o.shape},"symbol"),r&&(c+=o.shape.size+o.shape.spacing),l(o.key)){let t;t=o.key.multiLine?h.createOrUpdateChild(`${d}-key`,{visible:!0,...Ne(o.key),textBaseline:"top"},"richtext"):h.createOrUpdateChild(`${d}-key`,{visible:!0,...o.key,textBaseline:"top"},"text");const{textAlign:e}=o.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+o.key.spacing}if(l(o.value)){let t;t=o.value.multiLine?h.createOrUpdateChild(`${d}-${Xe}`,{visible:!0,...Ne(o.value),textBaseline:"top"},"richtext"):h.createOrUpdateChild(`${d}-${Xe}`,{visible:!0,...o.value,textBaseline:"top"},"text");let e="right";i.isValid(o.value.textAlign)?e=o.value.textAlign:l(o.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),h.add(t)}t+=o.height+o.spaceRow}))}}setAttributes(t,e){const s=Object.keys(t);this.attribute.autoCalculatePosition&&s.every((t=>Ue.includes(t)))?(this._mergeAttributes(t,s),i.isNil(this.attribute.panel.width)&&this.attribute.autoMeasure&&Ye.measureTooltip(this.attribute),Ye.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:o,positionY:l,parentBounds:d}=t;let h=n,c=r;return"left"===o?h-=e+s:"center"===o?h-=e/2:h+=s,"top"===l?c-=i+a:"middle"===l?c-=i/2:c+=a,h+e>d.x2&&(h-=e+s),c+i>d.y2&&(c-=i+a),h<d.x1&&(h=d.x1),c<d.y1&&(c=d.y1),t.x=h,t.y=c,t}static measureTooltip(t){const{content:s,contentStyle:a}=t,n=i.normalizePadding(t.padding),r=Ye.getTitleAttr(t);let o=0,d=n[0]+n[2],h=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);o=t,h=e}if(p&&e.builtinSymbolsMap[b]&&(o+=u.size+u.spacing,h=Math.max(u.size,h)),t.title&&(t.title.width=o,t.title.height=h),l(r)&&(d+=h+r.spaceRow),s?.length){const i=[];if(s.forEach(((e,s)=>{const a=Ye.getContentAttr(t,s);(e.key||e.value)&&l(a)&&i.push([e,a])})),i.length){let n=!1;const r=[],h=[],c=[];i.forEach((([t,s],o)=>{const{key:u,value:p,shape:b,spaceRow:g}=s,_=l(b),m=b?.symbolType??"",y=A(u),x=A(p);let f=0;if(l(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),f=Math.max(f,e)}if(l(p)){const{width:t,height:e}=x.quickMeasure(p.text);c.push(t),f=Math.max(f,e)}_&&e.builtinSymbolsMap[m]&&(n=!0,r.push(b.size),f=Math.max(b.size,f)),t.height=f,d+=f,o<i.length-1&&(d+=g??a.spaceRow)}));const u=r.length?Math.max(...r):0,p=h.length?Math.max(...h):0,b=c.length?Math.max(...c):0;o=Math.max(p+b+a.key.spacing+a.value.spacing+(n?u+a.shape.spacing:0),o),s.forEach((t=>{t.width=o})),t.hasContentShape=n,t.keyWidth=p,t.valueWidth=b}}return t.panel.width=o+n[1]+n[3],t.panel.height=d,t}static getTitleAttr(t){return Oe({},Ye.defaultAttributes.titleStyle,Ye.defaultAttributes.title,t.titleStyle,t.title)}static getContentAttr(t,e){return Oe({},Ye.defaultAttributes.contentStyle,t.contentStyle,t.content[e])}}t.AbstractComponent=n,t.BasePlayer=Ie,t.Brush=Re,t.CircleAxis=Pt,t.CircleCrosshair=$,t.ColorContinuousLegend=be,t.ContinuousPlayer=class extends Ie{_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(Se.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(Se.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(Se.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(Se.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=te,t.DEFAULT_ITEM_SPACE_ROW=ee,t.DEFAULT_LABEL_SPACE=8,t.DEFAULT_PAGER_SPACE=se,t.DEFAULT_SHAPE_SIZE=10,t.DEFAULT_SHAPE_SPACE=8,t.DEFAULT_STATES=At,t.DEFAULT_TITLE_SPACE=ie,t.DEFAULT_VALUE_SPACE=8,t.DataLabel=bt,t.DataZoom=Rt,t.DiscreteLegend=de,t.DiscretePlayer=class extends Ie{_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(Se.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(Se.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(Se.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(Se.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,(Te({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||Ce({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=yt,t.GroupFadeIn=Ht,t.GroupFadeOut=zt,t.GroupTransition=It,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,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==t)return void(o&&o.hideAll());if(i.isValid(e))if(!1!==e.visible){const t=i.merge({},i.get(ye,"title.style"),e.style);this._title=o.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=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(i.isValid(s)){const t=this._title&&e?.space?e.space:0,a=i.array(s),d=[];let h=0;a.forEach(((e,s)=>{if(!1!==e.visible){const a=i.merge({},i.get(ye,"content.style"),e.style),c=o.createOrUpdateChild("indicator-content-"+s,{...a,lineHeight:i.isValid(a.lineHeight)?a.lineHeight:a.fontSize,visible:e.visible,x:0,y:l+t+h},"text");e.autoFit&&i.isValidNumber(r)&&this._setAutoFit(r,c,e),e.autoLimit&&i.isValidNumber(n)&&c.setAttribute("maxLineWidth",r),d.push(c);const u=e?.space?e.space:0;h+=c.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=d}const d=o?.AABBBounds.height()??0;o.setAttribute("y",a.height/2-d/2),o.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=dt,t.LineAxis=Ct,t.LineCrosshair=O,t.LineLabel=ut,t.LinkPath=ve,t.MarkArea=qt,t.MarkLine=jt,t.MarkPoint=Jt,t.Pager=Qt,t.PolygonCrosshair=F,t.PopTip=k,t.RectCrosshair=N,t.RectLabel=ct,t.ScrollBar=r,t.SectorCrosshair=U,t.Segment=xt,t.SizeContinuousLegend=_e,t.Slider=pe,t.SymbolLabel=ht,t.Tag=E,t.Title=me,t.Tooltip=Ye,t.getHorizontalPath=xe,t.getSizeHandlerPath=ge,t.getVerticalPath=fe,t.loadPoptip=function(t){i.merge(I.poptip,t),e.container.load(D)},t.popTipModule=D,t.setPoptipTheme=function(t){i.merge(I.poptip,P,t)},t.version="0.13.13"}));
|