@visactor/react-vchart 2.0.13 → 2.0.14-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +7 -5
- package/build/index.min.js +1 -1
- package/package.json +5 -5
package/build/index.min.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Copyright 2011 - 2019 Tim Guan-tin Chien and contributors.
|
|
7
7
|
* Released under the MIT license
|
|
8
8
|
*/
|
|
9
|
-
let b$=class t extends r${constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),y=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=y*this.gridSize;const _=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,_,b);const M=u.getImageData(0,0,k,A).data;if(this.exceedTime())return null;const w=[];let C,T=S;const B=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),t<B[3]&&(B[3]=t),t>B[1]&&(B[1]=t),e<B[0]&&(B[0]=e),void(e>B[2]&&(B[2]=e))}};for(;T--;)for(C=x;C--;)P(T,C,w);return{datum:t,occupied:w,bounds:B,gw:S,gh:x,fillTextOffsetX:_,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t<this.ngx;t++)for(let i=0;i<this.ngy;i++)this.grid[t][i]&&e++;return e/t}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=g$(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=p$(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=e$(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};b$.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class x$ extends r${constructor(t){super(z({},x$.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e<i;e++)if(S$(t,this.result[e]))return!1;return!0}getTextInfo(t,e){const i={datum:t,fontSize:this.getTextFontSize(t),fontWeight:this.getTextFontWeight(t),fontStyle:this.getTextFontStyle(t),fontFamily:this.getTextFontFamily(t),angle:this.getTextRotate(t,e),text:this.getText(t)+"",x:this.center[0],y:this.center[1]},s=this.options.getTextBounds(i);return i.width=s.width(),i.height=s.height(),i.top=this.center[1]-i.height+.21*i.height,i.left=this.center[0]-i.width/2,i}layoutWord(t){const e=this.getTextInfo(this.data[t],t);let i=2*Math.PI,s=0,n=e.left,r=e.top;const a=e.width,o=e.height;let l=1,h=this.fit(e);for(;!h&&s<this.maxRadius;)s+=.5,l=this.shape(s/this.maxRadius*2*Math.PI),i+=.5*(this.options.random?this.random()>.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;i<t.length&&(this.layoutWord(i),i++,this.progressiveIndex=i,!this.exceedTime()););return this.result}}function S$(t,e){return!(t.left+t.width<e.left||t.top+t.height<e.top||t.left>e.left+e.width||t.top>e.top+e.height)}x$.defaultOptions={enlarge:!1};const k$={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},A$=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?M$(t.fontFamily):"sans-serif",d=t.fontStyle?M$(t.fontStyle):"normal",u=t.fontWeight?M$(t.fontWeight):"normal",p=t.rotate?M$(t.rotate):0,g=M$(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?M$(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",y=null!==(r=t.shrink)&&void 0!==r&&r,_=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},k$),t.as):k$,M=t.depth_3d,w=t.postProjection;let C=t.fontSize?M$(t.fontSize):14;const T=t.fontSizeRange;if(T&&!S(C)){const t=C,e=C$(T$(t,l),T);C=i=>e(t(i))}let B=o$;"fast"===t.layoutType?B=x$:"grid"===t.layoutType&&(B=b$);const P=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:C,shrink:y,clip:b,enlarge:_,minFontSize:x,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r<a;r++)n=e[r],s=n.datum,s[A.x]=n.x,s[A.y]=n.y,s[A.fontFamily]=n.fontFamily,s[A.fontSize]=n.fontSize,s[A.fontStyle]=n.fontStyle,s[A.fontWeight]=n.fontWeight,s[A.angle]=n.angle,"StereographicProjection"===w&&B$(h,n,s,A,M),t.dataIndexKey&&(s[t.dataIndexKey]=`${r}`),i.push(s);return i}}));return P.layout(l,{width:h[0],height:h[1]}),t.progressiveStep>0||t.progressiveTime>0?{progressive:P}:P.output()},M$=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],w$=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),C$=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=w$(t[0]),n=w$(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(w$(t)-r)/(a-r)*(e[1]-e[0])+e[0]},T$=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;a<n;++a)r=et(t(e[a])),r<i&&(i=r),r>s&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function B$(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l<Math.PI/2?1:-1)*Math.pow(Math.min(l-Math.PI/2,1),2)/5,{x:i*Math.sin(l)*Math.cos(o)+s.x,y:i*Math.cos(l)+s.y,z:i*Math.sin(l)*Math.sin(o)+s.z}}(t[0],t[1],r,{x:r,y:r,z:null!=n?n:r},e);i[s.x]=a.x,i[s.y]=a.y,i[s.z]=a.z}var P$;!function(t){t.BEFORE_WORDCLOUD_SHAPE_LAYOUT="beforeWordcloudShapeLayout",t.AFTER_WORDCLOUD_SHAPE_LAYOUT="afterWordcloudShapeLayout",t.AFTER_WORDCLOUD_SHAPE_DRAW="afterWordcloudShapeDraw"}(P$||(P$={}));const E$=t=>/^[\u4e00-\u9fa5]+$/.test(t),O$=(t,e)=>{if(u(t))return 0;let i=0;for(const e of t)E$(e)?i+=1:i+=.53;return i};function R$(t,e,i){const{stepFactor:s,importantWordCount:n,globalShinkLimit:r}=e,{size:a,segmentation:{regions:o},tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=l.getContext("2d",{willReadFrequently:!0}),g=j$(i);let f=g.slice(0);const m=e.fontSizeShrinkFactor;let v=null,y=1,_=1;const b=n;let x=0;t.length>b&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;e<o.length;e++){const i=o[e],{words:n,center:c,maxR:d,ratio:u}=i;let b=!1;for(let e=0;e<n.length;e++){F$(l,p,t,e);const i=n[e];if(i.x=c[0],i.y=c[1],!i.skip&&i.hasText&&i.sprite&&I$(f,i,d,u,a,h,s))i.hasPlaced=!0;else{if(!i.skip&&i.weight>x&&_>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==v&&(v=e,y=_),_*=m,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*m})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===v){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/_})),i.skip=!0,_=y,v=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i<e.textLayoutTimes;i++){const i=t.filter((t=>(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=Math.max(~~(t.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t<i.length;t++){const e=i[t];F$(l,p,i,t),e.x=c[0],e.y=c[1],e.hasText&&I$(f,e,d,u,a,h,s)&&(e.hasPlaced=!0)}}e.board=f}function I$(t,e,i,s,n,r,a){const o=e.x,l=e.y,h=function(t){return function(e){return[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}(s),c=1*a;let d,u,p,g=-c;for(;d=h(g+=c);){const{wordSize:s,bounds:{dTop:a,dBottom:h,dLeft:c,dRight:g}}=e;if(u=d[0],p=d[1],Math.min(Math.abs(u),Math.abs(p))>=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>n[0]||e.y-a<0||e.y+h>n[1]||D$(e,t,r)))return L$(e,t,r),!0}return!1}function L$(t,e,i){const{wordSize:s}=t,n=t.sprite,r=s[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t<c;t++){for(let i=0;i<r;i++)e[u+i]|=n[t*r+i];u+=a}else for(let t=0;t<c;t++){d=0;for(let i=0;i<=r;i++)e[u+i]|=d<<h|(i<r?(d=n[t*r+i])>>>l:0);u+=a}}function D$(t,e,i){const{sprite:s,wordSize:n}=t,r=i[0]>>5,a=n[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t<c;t++){for(let i=0;i<a;i++)if(e[u+i]&s[t*a+i])return!0;u+=r}else for(let t=0;t<c;t++){d=0;for(let i=0;i<=a;i++)if((d<<h|(i<a?(d=s[t*a+i])>>>l:0))&e[u+i])return!0;u+=r}return!1}function F$(t,e,i,s){if(i[s].sprite||0===i[s].fontSize)return;const n=2048,r=Math.PI/180,a=i.length;t.width=n,t.height=2048,e.clearRect(0,0,n,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=s;for(--s;++s<a;){const t=i[s],a=Math.max(t.fontSize,2);if(e.save(),e.font=t.fontStyle+" "+t.fontWeight+" "+a+"px "+t.fontFamily,o=e.measureText(t.text+"m").width+2*t.padding,l=2*a+2*t.padding,0!==t.rotate){const e=Math.sin(t.rotate*r),i=Math.cos(t.rotate*r),s=o*i,n=o*e,a=l*i,h=l*e;o=Math.max(Math.abs(s+h),Math.abs(s-h)),l=~~Math.max(Math.abs(n+a),Math.abs(n-a))}if(o=o+31>>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=n&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,n,u).data;let f,m;for(;--s>=p;){const t=i[s];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(m=0;m<r[1];m++){let t;for(f=0;f<r[0];f++)if(g[4*((c+m)*n+(h+f))+3]>0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,f<u&&(u=f),f>p&&(p=f),t|=e}t&&(m<l&&(l=m),m>d&&(d=m))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function j$(t){const{segmentation:{labels:e},boardSize:i,size:s}=t,n=i[0]>>5,r=new Array(n*s[1]).fill(0);for(let t=0;t<s[1];t++)for(let i=0;i<s[0];i++)if(0===e[t*s[0]+i]){const e=1<<31-i%32;r[n*t+(i>>5)]|=e}if(i[0]>s[0]){const t=(1<<i[0]-s[0])-1;for(let e=0;e<s[1];e++)r[n*e+n-1]|=t}return r}function z$(t,e,i){(function(t,e){const{segmentation:{regions:i}}=e;let s=-1/0,n=0,r=0;i.forEach(((t,e)=>{const i=t.area;i>s&&(s=i,r=e),n+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/n*t.length),o=i/s;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),a<t.length&&(i[r].wordsNum+=t.length-a);let o=r;const l=i.map((t=>t.regionNum));t.forEach((t=>{let e=0,s=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,s++,s>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),s=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?R$(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:s,stepFactor:n,importantWordCount:r}=e,{segmentation:{regions:a},tempCanvas:o,boardSize:l,shapeCenter:h,shapeMaxR:c,shapeRatio:d}=i,u=o.getContext("2d",{willReadFrequently:!0}),p=j$(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let v=0;t.length>m&&(v=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let y=0,_=1,b=!1;for(let r=0;r<a.length;r++){const h=a[r],{words:c,center:d,maxR:x,ratio:S}=h;let k=!1;for(let r=0;r<c.length;r++){F$(o,u,t,r);const a=c[r];if(a.x=d[0],a.y=d[1],a.hasText&&a.sprite&&I$(g,a,x,S,s,l,n)){if(a.hasPlaced=!0,a.weight>=v&&y++,y>=m&&!b){_*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),k=!0,y=0;break}}else{if(a.weight>=v&&_>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),_/=f,b=!0,g=p.slice(0),k=!0;break}if(a.weight>=v)return R$(t,e,i)}}k&&(r=-1)}for(let i=0;i<e.textLayoutTimes;i++){const i=t.filter((t=>(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=Math.max(~~(t.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t<i.length;t++){const e=i[t];F$(o,u,i,t),e.x=h[0],e.y=h[1],e.hasText&&I$(g,e,c,d,s,l,n)&&(e.hasPlaced=!0)}}e.board=g}(t,e,i):function(t,e,i){const{size:s,stepFactor:n}=e,{segmentation:{regions:r},tempCanvas:a,boardSize:o,shapeCenter:l,shapeMaxR:h,shapeRatio:c}=i,d=j$(i),u=a.getContext("2d",{willReadFrequently:!0});for(const e of r){const{words:i,center:r,maxR:l,ratio:h}=e;for(let e=0;e<i.length;e++){F$(a,u,t,e);const c=i[e];c.x=r[0],c.y=r[1],c.hasText&&c.sprite&&I$(d,c,l,h,s,o,n)&&(c.hasPlaced=!0)}}for(let i=0;i<e.textLayoutTimes;i++){const i=t.filter((t=>(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=Math.max(~~(t.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t<i.length;t++){const e=i[t];F$(a,u,i,t),e.x=l[0],e.y=l[1],e.hasText&&I$(d,e,h,c,s,o,n)&&(e.hasPlaced=!0)}}e.board=d}(t,e,i);const s=function(t,e,i){const{size:s,fillingTimes:n,fillingXStep:r,fillingYStep:a,getFillingFontStyle:o,getFillingFontWeight:l,getFillingFontFamily:h,fillingInitialFontSize:c,fillingDeltaFontSize:d,fillingInitialOpacity:u,fillingDeltaOpacity:p,fillingRotateList:g,getFillingPadding:f,random:m,board:v,minFillFontSize:y}=e,{boardSize:_,shapeBounds:b,tempCanvas:x,randomGenerator:S}=i,k=x.getContext("2d",{willReadFrequently:!0});let A=c,M=u;const w=[];for(let t=0;t<n;t++)C(A,M),A=Math.max(A>d?A-d:d,y),M=M>p?M-p:p;return w;function C(e,i){const n=t.map((t=>{const{text:s,color:n,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:s,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:n,fillingColor:r,hasPlaced:a,datum:c}}));T(n);let c=0;const{x1:d,y1:u,x2:p,y2:y}=b,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=y;t+=a)for(let e=A;e<=p;e+=r){F$(x,k,n,c);const i=n[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===n.length&&(c=0,m&&T(n));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>s[0]||i.y-l<0||i.y+h>s[1]||i.hasText&&i.sprite&&!D$(i,v,_)&&(L$(i,v,_),w.push(Object.assign({},i)),++c===n.length&&(c=0,m&&T(n)))}}function T(t){return t.sort((()=>S()-.5))}}(t,e,i),n=[],r=[];for(let e=0;e<t.length;e++)t[e].hasPlaced?r.push(t[e]):n.push(t[e]);return n.forEach((t=>t.visible=!1)),{fillingWords:s,successedWords:r,failedWords:n}}const H$={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"};class V${constructor(t){this.progressiveResult=[],this.options=t}layout(t){this.data=t;const e=this.options,i={shapeUrl:e.shape,size:e.size,ratio:e.ratio||.8,tempCanvas:void 0,boardSize:[0,0],random:!1,randomGenerator:void 0},s=this.options.createCanvas({width:e.size[0],height:e.size[1]}),n=s.getContext("2d",{willReadFrequently:!0});n.textAlign="center",n.textBaseline="middle",i.tempCanvas=s;const r=e.size[0]+31>>5<<5;if(i.boardSize=[r,e.size[1]],i.random?i.randomGenerator=Math.random:i.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})(),this.segmentationInput=i,y(i.shapeUrl)){i.isEmptyPixel=p$(void 0,void 0,this.options.createCanvas);const t=function(t,e){return t&&(M(t)||w(t)||t.startsWith("<svg"))?new Promise(((i,s)=>{var n;const r=e({image:t}),a=null===(n=r.resources)||void 0===n?void 0:n.get(t);a&&"success"===a.state&&a.data?i(a.data):(r.successCallback=()=>{var e;if(r){const n=null===(e=r.resources)||void 0===e?void 0:e.get(t);n&&"success"===n.state&&n.data?i(n.data):s(new Error("image load failed: "+t))}else s(new Error("image load failed: "+t))},r.failCallback=()=>{s(new Error("image load failed: "+t))})})):null}(i.shapeUrl,this.options.createImage);t?(this.isImageFinished=!1,this.isLayoutFinished=!1,t.then((t=>{this.isImageFinished=!0;const s=this.options.createCanvas({width:e.size[0],height:e.size[1],dpr:1});i.maskCanvas=s;const n=s.getContext("2d");e.removeWhiteBorder&&function(t,e,i){e.width=t.width,e.height=t.height;const s=e.getContext("2d",{willReadFrequently:!0});s.clearRect(0,0,e.width,e.height),s.drawImage(t,0,0);const n=e.width,r=s.getImageData(0,0,e.width,e.height);let a=0,o=r.height,l=0,h=r.width;const c=(t,e)=>{for(let s=0;s<t;++s)if(!i(r,e,s))return!1;return!0},d=(t,e,s)=>{for(let n=e;n<s;++n)if(!i(r,n,t))return!1;return!0};for(;a<o&&c(n,a);)++a;for(;o-1>a&&c(n,o-1);)--o;for(;l<h&&d(l,a,o);)++l;for(;h-1>l&&d(h-1,a,o);)--h;const u=s.getImageData(l,a,h-l,o-a);e.width=u.width,e.height=u.height,s.clearRect(0,0,e.width,e.height),s.putImageData(u,0,0)}(t,s,i.isEmptyPixel);const r=function(t,e){const i=t.width,s=t.height;let n=e[0]/i;s*n>e[1]&&(n=e[1]/s);const r=Math.floor(n*i),a=Math.floor(n*s);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:n}}(t,e.size);n.clearRect(0,0,e.size[0],e.size[1]),n.drawImage(t,r.x,r.y,r.width,r.height),this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i.maskCanvas)})).catch((t=>{this.isImageFinished=!0}))):(this.isImageFinished=!0,this.isLayoutFinished=!0)}else if(i.shapeUrl&&("text"===i.shapeUrl.type||"geometric"===i.shapeUrl.type)){i.isEmptyPixel=p$(i.shapeUrl.backgroundColor,void 0,this.options.createCanvas);const t=g$(i.shapeUrl,e.size[0],e.size[1],void 0,!1,this.options.createCanvas);i.maskCanvas=t,this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(t),this.doLayout(),this.isImageFinished=!0,this.isLayoutFinished=!0}}canAnimate(){return!0}unfinished(){return!this.isLayoutFinished}output(){return this.progressiveResult}progressiveRun(){this.isImageFinished&&!this.isLayoutFinished&&(this.segmentationInput.maskCanvas&&this.doLayout(),this.isLayoutFinished=!0)}progressiveOutput(){return this.progressiveResult}doLayout(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b;const x=this.segmentationInput,S=_$(x);if(!S.segmentation.regions.length)return;const k=this.options,A=this.data,M=k.colorMode||"ordinal",w={getText:Et(k.text),getFontSize:Et(k.fontSize),fontSizeRange:k.fontSizeRange,colorMode:M,getColor:k.colorField?Et(k.colorField):Et(k.text),getFillingColor:Et(k.fillingColorField),colorList:k.colorList||("ordinal"===M?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:Et(k.colorHexField),getFontFamily:Et(k.fontFamily||"sans-serif"),rotateList:k.rotateList||[0],getPadding:Et(k.padding||1),getFontStyle:Et(k.fontStyle||"normal"),getFontWeight:Et(k.fontWeight||"normal"),getFontOpacity:k.fontOpacity?Et(k.fontOpacity):()=>1};W$(A,w,S);const C={size:k.size,ratio:k.ratio||.8,shapeUrl:k.shape,random:void 0===k.random||k.random,textLayoutTimes:null!==(t=k.textLayoutTimes)&&void 0!==t?t:3,removeWhiteBorder:k.removeWhiteBorder,layoutMode:null!==(e=k.layoutMode)&&void 0!==e?e:"default",fontSizeShrinkFactor:null!==(i=k.fontSizeShrinkFactor)&&void 0!==i?i:.8,stepFactor:null!==(s=k.stepFactor)&&void 0!==s?s:1,importantWordCount:null!==(n=k.importantWordCount)&&void 0!==n?n:10,globalShinkLimit:k.globalShinkLimit||.2,fontSizeEnlargeFactor:null!==(r=k.fontSizeEnlargeFactor)&&void 0!==r?r:1.5,fillingRatio:null!==(a=k.fillingRatio)&&void 0!==a?a:.7,fillingTimes:null!==(o=k.fillingTimes)&&void 0!==o?o:4,fillingXStep:k.fillingXRatioStep?Math.max(Math.floor(k.size[0]*k.fillingXRatioStep),1):null!==(l=k.fillingXStep)&&void 0!==l?l:4,fillingYStep:k.fillingYRatioStep?Math.max(Math.floor(k.size[1]*k.fillingYRatioStep),1):null!==(h=k.fillingYStep)&&void 0!==h?h:4,fillingInitialFontSize:k.fillingInitialFontSize,fillingDeltaFontSize:k.fillingDeltaFontSize,fillingInitialOpacity:null!==(c=k.fillingInitialOpacity)&&void 0!==c?c:.8,fillingDeltaOpacity:null!==(d=k.fillingDeltaOpacity)&&void 0!==d?d:.05,getFillingFontFamily:Et(k.fillingFontFamily||"sans-serif"),getFillingFontStyle:Et(k.fillingFontStyle||"normal"),getFillingFontWeight:Et(k.fillingFontWeight||"normal"),getFillingPadding:Et(null!==(u=k.fillingPadding)&&void 0!==u?u:.4),fillingRotateList:null!==(p=k.fillingRotateList)&&void 0!==p?p:[0,90],fillingDeltaFontSizeFactor:null!==(g=k.fillingDeltaFontSizeFactor)&&void 0!==g?g:.2,fillingColorList:k.fillingColorList||["#537EF5"],sameColorList:!1,minInitFontSize:null!==(f=k.minInitFontSize)&&void 0!==f?f:10,minFontSize:null!==(m=k.minFontSize)&&void 0!==m?m:4,minFillFontSize:null!==(v=k.minFillFontSize)&&void 0!==v?v:2},T=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0})(w.colorList,C.fillingColorList);C.sameColorList=T,N$(A,w,C,k),function(t,e,i,s){const{getText:n}=e;let{fillingInitialFontSize:r,fillingDeltaFontSize:a}=i;const{fillingRatio:o}=i,l=Math.ceil(Math.sqrt(s.shapeArea)/4);if(!r||!a){const e=o/100,h=t.reduce(((t,e)=>{const i=O$(n(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*s.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(A,w,C,S);const{getText:B,getFontFamily:P,getFontStyle:E,getFontWeight:O,getPadding:R,getColor:I,getFillingColor:L,getColorHex:D,fontSizeScale:F,colorScale:j,fillingColorScale:z,getFontOpacity:H,rotateList:V}=w,N=A.map((t=>{var e,i;return{x:0,y:0,weight:0,text:B(t),fontFamily:P(t),fontWeight:O(t),fontStyle:E(t),rotate:V[~~(x.randomGenerator()*V.length)],fontSize:Math.max(C.minInitFontSize,~~F(t)),opacity:H(t),padding:R(t),color:D&&D(t)||j&&j(I(t))||"black",fillingColor:!L||(null===(e=k.colorField)||void 0===e?void 0:e.field)===(null===(i=k.fillingColorField)||void 0===i?void 0:i.field)&&T?void 0:D&&D(t)||z&&z(L(t))||"black",datum:t,visible:!0,hasPlaced:!1}})),W=X(N.map((t=>t.fontSize)));N.forEach((t=>t.weight=t.fontSize/W)),N.sort(((t,e)=>e.weight-t.weight));const{fillingWords:U,successedWords:G,failedWords:Y}=z$(N,C,S),$=null!==(_=null===(y=k.text)||void 0===y?void 0:y.field)&&void 0!==_?_:"textKey",K=null!==(b=k.dataIndexKey)&&void 0!==b?b:"defaultDataIndexKey",q=k.as?Object.assign(Object.assign({},H$),k.as):H$;let Z,J;const Q=[];for(let t=0;t<N.length;++t)Z=N[t],J=Z.datum,J[q.x]=Z.x,J[q.y]=Z.y,J[q.fontFamily]=Z.fontFamily,J[q.fontSize]=Z.fontSize,J[q.fontStyle]=Z.fontStyle,J[q.fontWeight]=Z.fontWeight,J[q.angle]=oe(Z.rotate),J[q.opacity]=Z.opacity,J[q.visible]=Z.visible,J[q.isFillingWord]=!1,J[q.color]=Z.color,J[K]=`${Z.text}_${t}_keyword`,Q.push(J);const tt=[];U.forEach(((t,e)=>{var i,s;const n=Object.assign({},t.datum);n[q.x]=t.x,n[q.y]=t.y,n[q.fontFamily]=t.fontFamily,n[q.fontSize]=t.fontSize,n[q.fontStyle]=t.fontStyle,n[q.fontWeight]=t.fontWeight,n[q.angle]=oe(t.rotate),n[q.opacity]=t.opacity,n[q.visible]=t.visible,n[q.isFillingWord]=!0,n[q.color]=L?(null===(i=k.colorField)||void 0===i?void 0:i.field)===(null===(s=k.fillingColorField)||void 0===s?void 0:s.field)&&T?t.color:t.fillingColor:C.fillingColorList[~~(x.randomGenerator()*C.fillingColorList.length)],n[$]=t.text,n[K]=`${t.text}_${e}_fillingWords`,tt.push(n)})),this.options.onLayoutFinished&&this.options.onLayoutFinished({successedWords:G,failedWords:Y}),this.progressiveResult=Q.concat(tt)}release(){this.segmentationInput=null,this.data=null,this.progressiveResult=null,this.options=null}}const N$=(t,e,i,s)=>{var n,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new BP).domain(e).range(g).scale(t),c&&((null===(n=s.colorField)||void 0===n?void 0:n.field)!==(null===(r=s.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new BP).domain(e).range(f).scale(t)}}else{1===g.length&&(g=[g[0],g[0]]);const e=(new QP).domain(G$(h,t)).range(g);if(u=t=>e.scale(t),c&&((null===(a=s.colorField)||void 0===a?void 0:a.field)!==(null===(o=s.fillingColorField)||void 0===o?void 0:o.field)||!d)){1===f.length&&(f=[f[0],f[0]]);const e=(new QP).domain(G$(c,t)).range(f);p=t=>e.scale(t)}}Object.assign(e,{colorScale:u,fillingColorScale:p})},W$=(t,e,i)=>{let{fontSizeRange:s}=e;const{getFontSize:n,getText:r}=e;let a;if(n){if(n&&s){const e=(new nE).domain(G$(n,t)).range(s);a=t=>e.scale(n(t))}else if(n&&d(n)&&!s){const e=.5,[o,l]=G$(n,t),h=t.map((t=>({text:r(t),value:n(t),weight:l===o?1:(n(t)-o)/(l-o)}))),c=U$(h,i,!0);s=[~~(e*c),~~c];const d=(new nE).domain(G$(n,t)).range(s);a=t=>d.scale(n(t))}}else{const e=t.map((t=>({text:r(t)}))),s=U$(e,i,!1);a="function"==typeof(o=s)?o:function(){return o}}var o;Object.assign(e,{getFontSize:n,fontSizeRange:s,fontSizeScale:a})},U$=(t,e,i)=>{const s=e.shapeArea,n=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(s)/12),o=t.reduce(((t,e)=>{const s=O$(e.text);return s<a?t+s*(i?(.5+.5*e.weight)**2:1):t}),0);if(0===o)return 12;let l=20;if(1===r.length)l=Math.sqrt(n*(s/(1.7*o)));else{const t=[];for(let e=0;e<r.length;e++){const i=r[e].area,a=r[e].ratio,l=i/s;if(l<.1)continue;const h=l*(o*(a<1?2.7-a:1.7)),c=Math.sqrt(n*(i/h));t.push(c)}l=t.length?Math.min(...t):Math.sqrt(n*(s/(1.7*o)))}return l};const G$=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;a<n;++a)r=et(t(e[a])),r<i&&(i=r),r>s&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]},Y$=(t,e,i)=>{if(!t.size||u(t.size[0])||u(t.size[1])||t.size[0]<=0||t.size[1]<=0)return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];if(t.size=[Math.ceil(t.size[0]),Math.ceil(t.size[1])],t.shape||at.getInstance().error("WordcloudShape shape must be specified."),t.text||at.getInstance().error("WordcloudShape text must be specified."),t.onBeforeLayout&&t.onBeforeLayout(),!e||0===e.length)return[];const s=new V$(t);return s.layout(e),s.unfinished()?{progressive:s}:s.output()};class $$ extends QG{constructor(){super(...arguments),this.type=MI.wordCloud}}$$.type=MI.wordCloud;const X$=()=>{iL.registerGrammarTransform("wordcloud",{transform:A$}),dU(),eY(),iL.registerSeries($$.type,$$)},K$=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:f=!1,isCone:m=!0,range:v}=e,y=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),_=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:_,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:y];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),y=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),_=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=A(_*v)&&0!==v?_/v:0,S=A(v*y)&&0!==y?v/y:0;u&&(t[u]=y),g&&(t[g]=_),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:_/b[1]),d&&(t[d]=0===e?1:y/b[1]),p&&(t[p]=v)})),n},q$=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},Z$=`${kL}_FUNNEL_TRANSFORM_RATIO`,J$=`${kL}_FUNNEL_REACH_RATIO`,Q$=`${kL}_FUNNEL_HEIGHT_RATIO`,tX=`${kL}_FUNNEL_VALUE_RATIO`,eX=`${kL}_FUNNEL_LAST_VALUE_RATIO`,iX=`${kL}_FUNNEL_NEXT_VALUE_RATIO`,sX=`${kL}_FUNNEL_LAST_VALUE`,nX=`${kL}_FUNNEL_CURRENT_VALUE`,rX=`${kL}_FUNNEL_NEXT_VALUE`,aX=`${kL}_FUNNEL_TRANSFORM_LEVEL`;class oX extends Ej{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?`${(100*(null==t?void 0:t[J$])).toFixed(1)}%`:this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class lX extends FF{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class hX extends lX{constructor(){super(...arguments),this.type=hX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}hX.type="polygon";const cX=()=>{iL.registerMark(hX.type,hX),nw(),XM(),sj(),iL.registerGraphicComponent("polygon",Nf)},dX=Object.assign(Object.assign({},Wj),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class uX extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class pX extends az{constructor(){super(...arguments),this.type=MI.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=uX,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;MD(this._dataSet,"funnel",K$),MD(this._dataSet,"funnelTransform",q$);const t=new so(this._dataSet,{name:`${kL}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new EF(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:nX,asTransformRatio:Z$,asReachRatio:J$,asHeightRatio:Q$,asValueRatio:tX,asNextValueRatio:iX,asLastValueRatio:eX,asLastValue:sX,asNextValue:rX,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:aX}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},pX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:ez(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},pX.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(pX.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(pX.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new oX(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",sF.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",sF.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",sF.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",sF.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",sF.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;p(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===this._funnelMark){this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",sF.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Wb(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&Wb(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*kI(J$).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",sF.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(Zj(null===(s=iL.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),Jj("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(Zj(iL.getAnimationInKey("fadeInOut")(),Jj(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(Zj(iL.getAnimationInKey("funnel")({},o),Jj(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(Zj(null===(a=iL.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),Jj("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[eX])/2:this._getSecondaryAxisLength(t[tX])/2,n=this._getSecondaryAxisLength(t[tX])/2):(s=this._getSecondaryAxisLength(t[tX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[iX])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[aX])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[CL]===t[CL]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_<this._minLabelLineWidth&&(_=y-this._minLabelLineWidth),v=m):(y=this._getPolygonCenter(i).y+s/2+e,_=!1!==f.alignLabel?(null==u?void 0:u.y1)-e:y+e,m=this._getPolygonCenter(i).x,_-y<this._minLabelLineWidth&&(_=y+this._minLabelLineWidth),v=m),{x1:m,x2:v,y1:y,y2:_}}const b=this.getPoints(t),x=(Math.abs(b[0].x-b[1].x)+Math.abs(b[2].x-b[3].x))/2,S=(null==g?void 0:g.x2)-(null==g?void 0:g.x1)||0,k=null!==(c=f.spaceWidth)&&void 0!==c?c:5;return"right"===this._spec.outerLabel.position||"left"===this._funnelAlign?(m=this._getPolygonCenter(b).x+Math.max(S/2,x/2)+k,v=!1!==f.alignLabel?(null==u?void 0:u.x1)-k:m+k,y=this._getPolygonCenter(b).y,v-m<this._minLabelLineWidth&&(v=m+this._minLabelLineWidth),_=y):(m=this._getPolygonCenter(b).x-Math.max(S/2,x/2)-k,v=!1!==f.alignLabel?(null==u?void 0:u.x2)+k:m-k,y=this._getPolygonCenter(b).y,m-v<this._minLabelLineWidth&&(v=m-this._minLabelLineWidth),_=y),{x1:m,x2:v,y1:y,y2:_}}_computeMaxSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width;return GI(null!==(t=this._spec.maxSize)&&void 0!==t?t:"80%",e)}_computeMinSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width;return GI(null!==(t=this._spec.minSize)&&void 0!==t?t:0,e)}_isHorizontal(){return"left"===this._funnelOrient||"right"===this._funnelOrient}_isReverse(){return"bottom"===this._funnelOrient||"right"===this._funnelOrient}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._funnelMark]}}pX.type=MI.funnel,pX.mark=dX,pX.builtInTheme={funnel:aL},pX.transformerConstructor=uX;const gX=()=>{cX(),dU(),kW(),iL.registerSeries(pX.type,pX),iL.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},KF))),iL.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:JT,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),ZF()},fX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},mX=t=>{const e=t.filter((t=>t.context.diffState===SF.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},vX=(t,e,i)=>E(t)?[e,i]:[K(t.map((t=>1*t.getFinalAttribute().startAngle))),X(t.map((t=>1*t.getFinalAttribute().endAngle)))],yX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=mX(i.parent.children),a=vX(r,s,n);return fX(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=mX(i.parent.children),a=vX(r,s,n);return fX(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),_X=t=>[K(t.map((t=>1*t.getFinalAttribute().startAngle))),X(t.map((t=>1*t.getFinalAttribute().endAngle)))],bX=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=mX(i.parent.children),a=_X(r);return fX(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=mX(i.parent.children),a=_X(r);return fX(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),xX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},SX=(t,e={})=>{if(!t)return[];const i=[];return rY(t,i,e),i},kX=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new RY(i).layout(t,{width:s,height:n})};class AX extends Ej{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var MX;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(MX||(MX={}));const wX=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===MX.DrillDown){return Y(aD(t,n,s,"children"))}if(i.type===MX.DrillUp){const e=oD(t,n,s,"children");if(e)return Y(e)}return t};class CX{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=nW(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;MD(t,"drillFilter",wX),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!_(t)||E(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:MX.DrillDown},e().reRunAllTransform(),i.emit(yD.drill,{value:{path:t,type:MX.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!_(n)||E(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:MX.DrillUp},i().reRunAllTransform(),s.emit(yD.drill,{value:{path:n,type:MX.DrillUp},model:this}),n}}const TX=Object.assign(Object.assign({},Wj),{sunburst:{name:"sunburst",type:"arc"}}),BX=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:Dj,operations:["max","min","values"]}),t.push({key:Fj,operations:["values"]}),t),PX={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class EX extends MU{constructor(){super(...arguments),this.type=MI.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:Fj),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:CL},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),MD(this._dataSet,"sunburstLayout",kX),MD(this._dataSet,"flatten",SX),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return BX(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(MD(t.dataSet,"addVChartProperty",kj),t.transform({type:"addVChartProperty",options:{beforeCall:Vj.bind(this),call:Nj}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(EX.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},kF.STATE_NORMAL,sF.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(EX.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},kF.STATE_NORMAL,sF.Series)}initTooltip(){this._tooltipHelper=new AX(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),Jj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),Jj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}EX.type=MI.sunburst,EX.mark=TX,EX.builtInTheme={sunburst:PX},G(EX,CX);const OX=()=>{iL.registerSeries(EX.type,EX),jU(),dU(),ZF(),iL.registerAnimation("sunburst",((t,e)=>({appear:xX(0,e),enter:yX(t),exit:bX(t),disappear:{duration:$F.disappear.duration}})))},RX=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return 0===s||0===n?t:new xY(i).layout(t,{width:s,height:n})};class IX extends Ej{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const LX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},DX=Object.assign(Object.assign({},Wj),{circlePacking:{name:"circlePacking",type:"arc"}});class FX extends hz{constructor(){super(...arguments),this.type=MI.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:Fj),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:CL},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),MD(this._dataSet,"circlePackingLayout",RX),MD(this._dataSet,"flatten",SX),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(MD(t.dataSet,"addVChartProperty",kj),t.transform({type:"addVChartProperty",options:{beforeCall:Vj.bind(this),call:Nj}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(FX.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},kF.STATE_NORMAL,sF.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(FX.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},kF.STATE_NORMAL,sF.Series)}getStatisticFields(){return BX(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new IX(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(Zj(null===(i=iL.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),Jj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),Jj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}FX.type=MI.circlePacking,FX.mark=DX,FX.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(FX,CX);const jX=()=>{iL.registerSeries(FX.type,FX),jU(),dU(),qF(),iL.registerAnimation("circlePacking",((t,e)=>({appear:LX(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:$F.disappear.duration}})))},zX=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&zX(t,e.children,i)}))},HX=t=>{var e;if(!t||!_(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},VX=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new PY(e),r=[];return r.push(n.layout(s,i)),r},NX=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},WX=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class UX extends Ej{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const GX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:((t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}))(t),YX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class $X extends BT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class XX extends BT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const KX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},qX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class ZX extends YW{constructor(){super(...arguments),this.type=ZX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?qX:KX,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}ZX.type="linkPath";const JX=Object.assign(Object.assign({},Wj),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class QX extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const tK=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class eK extends hz{constructor(){super(...arguments),this.type=MI.sankey,this.transformerConstructor=QX,this._nodeLayoutZIndex=eF.Node,this._labelLayoutZIndex=eF.Label,this._viewBox=new $e,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{t.removeState(kF.STATE_SANKEY_EMPHASIS),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE)})),s.forEach((t=>{t.removeState(kF.STATE_SANKEY_EMPHASIS),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=pD(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=pD(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(kF.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(kF.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(kF.STATE_SANKEY_EMPHASIS),t.addState(kF.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=pD(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),tK(e,kF.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(kF.STATE_SANKEY_EMPHASIS),e.addState(kF.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=pD(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=pD(n[0]))||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=pD(n),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=pD(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(kF.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(kF.STATE_SANKEY_EMPHASIS),t.addState(kF.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;r<n;r++){const n=s[r].key,a=s[r+1]?s[r+1].key:i.key,o=e.value,l=t.find((t=>t.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=pD(s),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0)/a.value;return s.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),void tK(s,kF.STATE_SANKEY_EMPHASIS,{ratio:e})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),void tK(s,kF.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState(kF.STATE_SANKEY_EMPHASIS),s.addState(kF.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(i&&i.length){if("source"==(pD(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{t.removeState(kF.STATE_SANKEY_EMPHASIS),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&e.forEach((t=>{t.removeState(kF.STATE_SANKEY_EMPHASIS),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const s=pD(t),n=[s.source,s.target],r=[];Y(s.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;s<i-1;s++){const i=e[s].key,n=e[s+1].key,a=t.value,o=r.find((t=>t.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),i.forEach((t=>{const e=pD(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),void tK(t,kF.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0)/e.value;return t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),void tK(t,kF.STATE_SANKEY_EMPHASIS,{ratio:i})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),void tK(t,kF.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});t.removeState(kF.STATE_SANKEY_EMPHASIS),t.addState(kF.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,n)}this._needClear=!0}}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){MD(this._dataSet,"sankeyLayout",VX),MD(this._dataSet,"sankeyFormat",HX),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:FD.sankeyLayout});const{dataSet:a}=this._option;MD(a,"sankeyNodes",NX),MD(a,"flatten",SX);const o=new so(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:zj.bind(this),call:Hj}},!1),this._nodesSeriesData=o,MD(a,"sankeyLinks",WX);const l=new so(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:zj.bind(this),call:Hj}},!1),this._linksSeriesData=l}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(eK.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(eK.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},kF.STATE_NORMAL,sF.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",sF.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},kF.STATE_NORMAL,sF.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",sF.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=bj(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(Zj(null===(i=iL.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),Jj("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(Zj(null===(s=iL.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),Jj("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:bD.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([kF.STATE_SANKEY_EMPHASIS_REVERSE,kF.STATE_SANKEY_EMPHASIS]),e.includes(pD(t).key)?t.addState(kF.STATE_SANKEY_EMPHASIS,!0):t.addState(kF.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new UX(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new FI;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{i.add(t[e]),t.children&&this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;return this._rawStatisticsCache||(this._rawStatisticsCache={}),this._rawStatisticsCache[t]||(this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})),this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return zX(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}eK.type=MI.sankey,eK.transformerConstructor=QX,eK.mark=JX,eK.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const iK=()=>{wN(),$W(),YM(),iL.registerGraphicComponent("path",(t=>Ef(t))),iL.registerMark(ZX.type,ZX),dU(),iL.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:GX(t,e)},KF))),iL.registerAnimation("sankeyLinkPath",((t,e)=>({appear:YX(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:$F.disappear.duration}}))),yT.registerBuiltInAnimate("linkPathGrowOut",XX),yT.registerBuiltInAnimate("linkPathGrowIn",$X),ZF(),iL.registerSeries(eK.type,eK)},sK=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=SX(n);return i=Rj([{latestData:r}],e),i};class nK extends Ej{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const rK=Object.assign(Object.assign({},Wj),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),aK=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class oK extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const lK=(t,e)=>{if(e.getViewBox()){const i=new FY(e).layout(t,e.getViewBox()),s=[];return rY(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[Fj,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class hK extends hz{constructor(){super(...arguments),this.type=MI.treemap,this.transformerConstructor=oK,this._categoryField="name",this._valueField="value",this._viewBox=new $e,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:Fj),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new qe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:CL},getRawData:()=>this.getRawData()}),A(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),MD(this._dataSet,"treemap",lK),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(MD(this._rawData.dataSet,"addVChartProperty",kj),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Vj.bind(this),call:Nj}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=sK([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){MD(this._dataSet,"hierarchyDimensionStatistics",sK),MD(this._dataSet,"flatten",SX);const i=new so(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return BX(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(hK.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(hK.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},kF.STATE_NORMAL,sF.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},kF.STATE_NORMAL,sF.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},kF.STATE_NORMAL,sF.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},kF.STATE_NORMAL,sF.Series),this._initRichStyleOfLabelMark(t))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},kF.STATE_NORMAL,sF.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("treemap"))||void 0===e?void 0:e(),Jj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new nK(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(mD.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(mD.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}hK.type=MI.treemap,hK.mark=rK,hK.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},hK.transformerConstructor=oK,G(hK,CX),G(hK,aW);const cK=()=>{iL.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),iL.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),wN(),dU(),iL.registerAnimation("treemap",((t,e)=>({appear:aK(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:$F.disappear.duration}}))),ZF(),iL.registerSeries(hK.type,hK)},dK=Object.assign(Object.assign({},PG),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),uK=Object.assign(Object.assign({},Wj),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),pK={type:"fadeIn"};function gK(t,e){return"fadeIn"===e?pK:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class fK extends rz{constructor(){super(...arguments),this._supportStack=!1}}class mK extends Ej{enableByType(t){return"dimension"!==t}}const vK="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",yK={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:vK,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:vK,fill:"#ddd"}}};class _K extends EG{constructor(){super(...arguments),this.type=MI.gaugePointer,this.transformerConstructor=fK,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(_K.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},_K.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(_K.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new mK(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=K(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(Zj(null===(i=iL.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Jj("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}_K.type=MI.gaugePointer,_K.mark=uK,_K.builtInTheme={gaugePointer:yK},_K.transformerConstructor=fK;const bK=()=>{iL.registerSeries(_K.type,_K),QN(),wN(),iL.registerAnimation("gaugePointer",((t,e)=>{const i=gK(t,e);return{appear:i,enter:i,disappear:{duration:$F.disappear.duration}}})),oG(),rG()};class xK extends rz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class SK extends EG{constructor(){super(...arguments),this.type=MI.gauge,this.transformerConstructor=xK,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData(),MD(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[YL]=t[this._angleField[0]],t[GL]=e>0?i[e-1][YL]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(SK.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(SK.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,sF.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?HI(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?HI(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[GL])?this.angleAxisHelper.dataToPosition([t[GL]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[YL]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(Zj(null===(i=iL.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Jj("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}SK.type=MI.gauge,SK.mark=dK,SK.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},SK.transformerConstructor=xK;const kK=()=>{iL.registerSeries(SK.type,SK),jU(),LG(),rG()};class AK extends FF{constructor(){super(...arguments),this.type=AK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return nf(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}AK.type="cell";function MK(t){return!1===t?{}:{type:"fadeIn"}}class wK extends Ej{enableByType(t){return"dimension"!==t}}const CK=Object.assign(Object.assign({},Wj),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class TK extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class BK extends hz{constructor(){super(...arguments),this.type=MI.heatmap,this.transformerConstructor=TK}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(BK.mark.cell,{isSeriesMark:!0},{morph:ez(this._spec,BK.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(BK.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",sF.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=ui(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",sF.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=lz(this);this._cellMark.setAnimationConfig(Zj(null===(i=iL.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),Jj("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new wK(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}BK.type=MI.heatmap,BK.mark=CK,BK.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1}}},BK.transformerConstructor=TK;const PK=()=>{dU(),iL.registerMark(AK.type,AK),iL.registerGraphicComponent("symbol",nf),nw(),aw(),XE(),iL.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},KF),{appear:MK(e)}))),XH(),UH(),iL.registerSeries(BK.type,BK)},EK=Object.assign(Object.assign({},Wj),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),OK=`${kL}_CORRELATION_X`,RK=`${kL}_CORRELATION_Y`,IK=`${kL}_CORRELATION_SIZE`,LK=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const b=oe(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=oe(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),A=Ot(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Ot(e.outerRadius,k),w=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+Ot(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+Ot(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],C=Pt(e.field),T=t.map(C),[B,P]=It(T),E=B===P?t=>(A+M)/2:t=>A+(M-A)*(t-B)/(P-B),O=u(e.radiusField)?C:Pt(e.radiusField),R=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let I=t=>R;if(O){const[i,s]=O!==C?It(t.map(O)):[B,P],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(O(t)-i)/(s-i))}const L=Math.min(b,x),D=Math.max(b,x),F=DK(L,D,t.length),j=[],z=(D-L)/60;return t.forEach(((t,e)=>{const i=E(T[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),FK({x:n,y:r,size:s},j)||n-s<y.x0||n+s>y.x1||r-s<y.y0||r+s>y.y1);t++)t<59&&(a+=z,a>D?a=L:a<L&&(a=D));j.push(Object.assign({[OK]:n,[RK]:r,[IK]:s},t))})),j},DK=(t,e,i)=>{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l<i;)h<n&&(c.push(d+(h%2?Math.floor(h/2)+Math.floor(n/2):h/2)*r*o),h++),l++,h===n&&(h=0,a+=1,o*=-1,0===s?s=r/2:s/=2,d=-1===o?e-s:t+s,a>=2&&(r/=2,n*=2));return c},FK=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<Math.pow(t.size+e.size,2))),jK=(t,e)=>{if(!t||!_(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[wL]:null==n?void 0:n[wL],[TL]:null==n?void 0:n[TL]}};class zK extends YW{constructor(){super(...arguments),this.type=zK.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=vt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}zK.type="ripple";const HK=()=>{$W(),aw(),iL.registerMark(zK.type,zK),iL.registerGraphicComponent("symbol",(t=>nf(t)))},VK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class NK extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class WK extends MU{constructor(){super(...arguments),this.type=MI.correlation,this.transformerConstructor=NK,this._viewBox=new $e}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;MD(this._dataSet,"correlation",LK);const s=new io;wD(s,"dataview",za),MD(s,"correlationCenter",jK);const n=new so(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new EF(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const t=this._createMark(WK.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:wL});t&&(t.setMarkConfig({zIndex:eF.Node}),this._nodePointMark=t);const e=this._createMark(WK.mark.ripplePoint,{key:wL,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(WK.mark.centerPoint,{key:wL,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:eF.Node}),this._centerPointMark=i)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[OK],y:t=>t[RK],size:t=>t[IK],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},kF.STATE_NORMAL,sF.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},kF.STATE_NORMAL,sF.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},kF.STATE_NORMAL,sF.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},kF.STATE_NORMAL,sF.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),Jj("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}WK.type=MI.correlation,WK.mark=EK,WK.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},WK.transformerConstructor=NK;const UK=()=>{Lz(),HK(),iL.registerSeries(WK.type,WK),iL.registerAnimation("correlation",((t,e)=>Object.assign({appear:VK(0,e)},XF)))},GK={duration:2e3,loop:!0,channel:{wave:{from:0,to:1}}},YK=t=>({duration:2e3,channel:{wave:{from:0,to:1},height:t.height,dy:t.dy}}),$K=YK;function XK(t,e){switch(e){case"wave":default:return GK;case"grow":return YK(t);case"waveGrow":return $K(t)}}function KK(t,e){switch(e){case"wave":default:return GK;case"grow":case"waveGrow":return(t=>({duration:2e3,channel:{dy:t.dy}}))(t)}}const qK=Object.assign(Object.assign({},Wj),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class ZK extends YW{constructor(){super(...arguments),this.type=ZK.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}ZK.type="liquid";const JK=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class QK extends Ej{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class tq extends az{constructor(){super(...arguments),this.type=MI.liquid,this.transformerConstructor=Dz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=df({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=nf({x:s,y:n,size:r,symbolType:JK(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=$I(this._spec.outlineMargin),this._paddingSpec=$I(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(tq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(tq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(tq.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(tq.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",sF.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",sF.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",sF.Series)}initTooltip(){this._tooltipHelper=new QK(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(Zj(null===(i=iL.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),Jj("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(Zj(null===(s=iL.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),Jj("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(yD.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(r<e&&a>i){const e=Pw(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}tq.type=MI.liquid,tq.mark=qK,tq.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},tq.transformerConstructor=Dz;const eq=()=>{$W(),IM(),iL.registerMark(ZK.type,ZK),iL.registerGraphicComponent("area",(t=>If(t))),zF(),iL.registerAnimation("liquid",((t,e)=>({appear:XK(t,e),enter:XK(t,e),exit:XK(t,e)}))),iL.registerAnimation("liquidGroup",((t,e)=>({appear:KK(t,e),enter:KK(t,e),exit:KK(t,e)}))),iL.registerSeries(tq.type,tq)},iq=t=>Y(t).join(",");class sq extends Ej{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>iq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>iq(null==t?void 0:t[this.series.getDimensionField()[0]])}}const nq=Object.assign(Object.assign({},Wj),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}}),rq=t=>{switch(t){case"fadeIn":default:return{type:"fadeIn"};case"growIn":return{type:"growRadiusIn"};case"scaleIn":return{type:"scaleIn"}}},aq=t=>{switch(t){case"fadeIn":default:return{type:"fadeIn"};case"scaleIn":return{type:"scaleIn"}}};class oq extends BT{onBind(){var t,e;this.fromCircles={},null===(t=qY(this.target.attribute.arcs))||void 0===t||t.forEach((t=>{this.fromCircles[t.setId]=t})),this.toCircles={},null===(e=qY(this.target.getFinalAttribute().arcs))||void 0===e||e.forEach((t=>{this.toCircles[t.setId]=t}))}onUpdate(t,e,i){const s=[];Object.keys(this.fromCircles).forEach((t=>{const i=this.fromCircles[t],n=this.toCircles[t];i&&n&&s.push({radius:i.radius+(n.radius-i.radius)*e,x:i.x+(n.x-i.x)*e,y:i.y+(n.y-i.y)*e,setId:t})}));const n=XY(s);this.target.setAttributes({arcs:n,path:KY(n)})}}class lq extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const hq=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?ZY(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class cq extends az{constructor(){super(...arguments),this.type=MI.venn,this.transformerConstructor=lq,this._viewBox=new $e}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:CL)}initData(){var t;super.initData(),MD(this._dataSet,"venn",hq),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(cq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(cq.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},kF.STATE_NORMAL,sF.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},kF.STATE_NORMAL,sF.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},kF.STATE_HOVER,sF.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>iq(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},kF.STATE_NORMAL,sF.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>iq(t.sets)},kF.STATE_NORMAL,sF.Series))}initTooltip(){this._tooltipHelper=new sq(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:iq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return iq(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[iq(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(iq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),Jj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),Jj(t.name,this._spec,this._markAttributeContext)))}))}}cq.type=MI.venn,cq.mark=nq,cq.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},cq.transformerConstructor=lq;const dq=()=>{jU(),QN(),iL.registerAnimation("vennCircle",((t,e)=>({appear:rq(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:$F.disappear.duration}}))),iL.registerAnimation("vennOverlap",((t,e)=>({appear:aq(e),update:{custom:oq},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:$F.disappear.duration}}))),ZF(),iL.registerGrammarTransform("vennMark",{transform:JY}),iL.registerSeries(cq.type,cq)};class uq extends EN{constructor(){super(...arguments),this.type=MI.mosaic,this.transformerConstructor=PN}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(NL),this.setFieldX2(VL)),this.setFieldY(UL),this.setFieldY2(WL)):(t&&(this.setFieldY(NL),this.setFieldY2(VL)),this.setFieldX(UL),this.setFieldX2(WL)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=a%2?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}uq.type=MI.mosaic,uq.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},uq.transformerConstructor=PN;const pq=()=>{wN(),dU(),ZF(),UH(),iL.registerSeries(uq.type,uq)};class gq extends SV{_isValidSeries(t){return t===MI.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}let fq=class extends bV{constructor(){super(...arguments),this.transformerConstructor=gq,this.type="map",this.seriesType=MI.map}};fq.type="map",fq.seriesType=MI.map,fq.transformerConstructor=gq;const mq=()=>{iN(),uW(),iL.registerChart(fq.type,fq)};class vq extends SV{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class yq extends vq{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=Xz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,eL({},s,l)),n&&Object.assign(o,eL({},n,o))}}class _q extends vq{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class bq extends vq{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class xq extends bV{constructor(){super(...arguments),this.transformerConstructor=bq}}xq.transformerConstructor=bq;let Sq=class extends xq{constructor(){super(...arguments),this.transformerConstructor=bq,this.type="pie",this.seriesType=MI.pie}};Sq.type="pie",Sq.seriesType=MI.pie,Sq.transformerConstructor=bq;const kq=()=>{iN(),UU(),iL.registerChart(Sq.type,Sq)};class Aq extends _q{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:cH,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:cH,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>eL({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const Mq=(t,e)=>{if(!t)return null;const i=kz(t,(t=>"angle"===t.getOrient()),e),s=kz(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&hP(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=vI({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return t<s?t+=Math.ceil((s-t)/i)*i:t>n&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=yI(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=xz(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&hP(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=vI({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=yI(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=xz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};let wq=class extends bV{constructor(){super(...arguments),this.transformerConstructor=Aq,this.type="rose",this.seriesType=MI.rose}_setModelOption(){this._modelOption.getDimensionInfo=Mq}};wq.type="rose",wq.seriesType=MI.rose,wq.transformerConstructor=Aq,G(wq,CV);const Cq=()=>{tN(),iN(),EV(),PV(),hG(),iL.registerChart(wq.type,wq)};class Tq extends _q{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=eL({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>eL({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}let Bq=class extends bV{constructor(){super(...arguments),this.transformerConstructor=Tq,this.type="radar",this.seriesType=MI.radar}_setModelOption(){this._modelOption.getDimensionInfo=Mq}};Bq.type="radar",Bq.seriesType=MI.radar,Bq.transformerConstructor=Tq,G(Bq,CV);const Pq=()=>{tN(),iN(),nN(),EV(),PV(),yG(),iL.registerChart(Bq.type,Bq)};class Eq extends SV{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{O(e,"trimPadding")&&eL(e,tF(this.type,t))})),this._transformAxisSpec(t)}}let Oq=class extends bV{constructor(){super(...arguments),this.transformerConstructor=Eq,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=FV(t,e,i))&&void 0!==s?s:[],...null!==(n=Mq(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};Oq.type="common",Oq.transformerConstructor=Eq,G(Oq,CV);const Rq=()=>{tN(),iN(),nN(),EV(),iL.registerChart(Oq.type,Oq),PV()};class Iq extends SV{_getSeriesDataLength(t,e){var i,s;if(e.data){const t=Y(e.data)[0];return t instanceof so?null===(i=t.latestData)||void 0===i?void 0:i.length:null===(s=t.values)||void 0===s?void 0:s.length}const n=Y(t.data).find(((t,i)=>e.dataId?t instanceof so?t.name===e.dataId:t.id===e.dataId:e.dataIndex===i));return n?n instanceof so?n.latestData.length:n.values.length:0}addAttrToComponentSpec(t,e,i){return Array.isArray(t)?t[0][e]=i:t[e]=i,t}addPaddingRow(t,e,i){t.push({index:e,size:i})}addOrientAxes(t,e,i,s){t.push({id:`regionAxesRow${i}`}),e.push({modelId:`axesRow${i}`,col:1,row:i}),s.axes[0].id=`axesRow${i}`,s.axes[0].regionIndex=Array.from(Array(s.series.length),((t,e)=>"top"===s.axes[0].orient?e+1:e))}transformSpec(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;super.transformSpec(t);let m=0;const v=[],y=[],_=[],b=[],x=[],S=this._option.getCompiler().getStage(),k=(S.viewWidth,S.viewHeight);let A=0;if(null==t?void 0:t.legends){v.push({modelId:`legendRow${m}`,col:1,row:m}),this.addAttrToComponentSpec(t.legends,"id",`legendRow${m}`);const o=Y(t.legends);let l=null!==(e=o[0].height)&&void 0!==e?e:40;if(o[0].padding){const t=$I(o[0].padding);l+=Number(null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0),l+=Number(null!==(s=null==t?void 0:t.top)&&void 0!==s?s:0),o[0].offsetY=Number(null!==(r=null===(n=o[0])||void 0===n?void 0:n.offsetY)&&void 0!==r?r:0)+Number(null!==(a=null==t?void 0:t.top)&&void 0!==a?a:0)}x.push({index:m,size:l}),A+=l,m++}(null==t?void 0:t.dataZoom)&&(v.push({modelId:`dataZoomRow${m}`,col:1,row:m}),this.addAttrToComponentSpec(t.dataZoom,"id",`dataZoomRow${m}`),A+=60,m++,this.addPaddingRow(x,m,10),A+=10,m++),A+=60,null!==t.axes&&"top"!==(null===(l=null===(o=null==t?void 0:t.axes)||void 0===o?void 0:o[0])||void 0===l?void 0:l.orient)||(this.addOrientAxes(y,v,m,t),m++);const M=t.series.filter((t=>t.type!==MI.link)).length,w=(k-A-20*M)/M,C=(null===(h=null==t?void 0:t.appendPadding)||void 0===h?void 0:h.left)||0,T=(null===(c=null==t?void 0:t.appendPadding)||void 0===c?void 0:c.right)||0;null===(d=null==t?void 0:t.series)||void 0===d||d.forEach((e=>{var i,s;if([MI.bar,MI.line,MI.area,MI.dot].includes(e.type)){if(v.push({modelId:`${e.type}Row${m}`,col:1,row:m}),v.push({modelId:`axesLeftRow${m}`,col:0,row:m}),y.push({id:`${e.type}Row${m}`,clip:!1}),x.push({index:m,size:(null==e?void 0:e.height)||w}),_.push({orient:"left",id:`axesLeftRow${m}`,type:e.type===MI.dot?"band":"linear",visible:e.type!==MI.dot,title:{visible:!0,autoRotate:!1,style:{text:null==e?void 0:e.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof(null===(i=null==e?void 0:e.grid)||void 0===i?void 0:i.visible)||(null===(s=null==e?void 0:e.grid)||void 0===s?void 0:s.visible),style:(t,i)=>{var s,n,r,a,o;let l=0;if(0===i){const t=null===(s=null==e?void 0:e.grid)||void 0===s?void 0:s.style;l=null!==(r=null!==(n=null==t?void 0:t.lineWidth)&&void 0!==n?n:null==t?void 0:t.strokeWidth)&&void 0!==r?r:1}return{lineWidth:l,stroke:(null===(o=null===(a=null==e?void 0:e.grid)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:y.length-1}),e.type===MI.dot){v.push({modelId:`scrollBarRightRow${m}`,col:2,row:m});const i=this._getSeriesDataLength(t,e);let s=0;i&&(s=((null==e?void 0:e.height)||w)/(30*i)),b.push(Object.assign({orient:"right",visible:e.type===MI.dot&&s<1,id:`scrollBarRightRow${m}`,start:0,end:Math.min(s,1),filterMode:"axis",regionIndex:y.length-1,axisId:`axesLeftRow${m}`},Y(null==t?void 0:t.scrollBar)[0]))}e.regionIndex=y.length-1,m++,this.addPaddingRow(x,m,(null==e?void 0:e.padding)||20),m++,e.leftAppendPadding=C,e.type===MI.dot&&(e.title.style.dx=-C,e.subTitle.style.dx=-C)}})),this.addPaddingRow(x,m,20),m++,null===(u=null==t?void 0:t.series)||void 0===u||u.forEach((e=>{if(e.type===MI.link){const i=e.dotSeriesIndex+1;v.push({modelId:`${e.type}Row${i}`,col:1,row:i-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=C,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),(null==t?void 0:t.legends)&&this.addAttrToComponentSpec(t.legends,"regionIndex",[y.length-1]),"bottom"===(null===(g=null===(p=null==t?void 0:t.axes)||void 0===p?void 0:p[0])||void 0===g?void 0:g.orient)&&(this.addOrientAxes(y,v,m,t),m++);const B={type:"grid",col:4,row:m,colWidth:[{index:0,size:C},{index:2,size:12},{index:3,size:T}],rowHeight:x,elements:v};t.layout=B,t.region=y,null===(f=t.axes)||void 0===f||f.push(..._),t.scrollBar=b}}var Lq=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};let Dq=class extends bV{constructor(){super(...arguments),this.transformerConstructor=Iq,this.type="sequence"}_createSeries(t,e){if(!t)return;const{spec:i}=e,s=Lq(e,["spec"]);let n;if(i.type===MI.link&&(i.dotSeriesSpec=this._spec.series[i.dotSeriesIndex]),i.regionId&&(n=this.getRegionsInUserId(i.regionId)),n||(n=this.getRegionsInIndex(i.regionIndex?[i.regionIndex]:void 0)[0]),!n)return;const r=new t(i,Object.assign(Object.assign(Object.assign({},this._modelOption),s),{region:n,specKey:"series",globalScale:this._globalScale}));r&&(r.created(),this._series.push(r),n.addSeries(r))}};Dq.type="sequence",Dq.transformerConstructor=Iq;const Fq=()=>{tN(),iN(),AG(),BG(),XH(),UH(),iL.registerChart(Dq.type,Dq)};class jq extends kV{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class zq extends bV{constructor(){super(...arguments),this.transformerConstructor=jq}}zq.transformerConstructor=jq,G(zq,CV);class Hq extends jq{transformSpec(t){super.transformSpec(t),ZD(t)}}let Vq=class extends zq{constructor(){super(...arguments),this.transformerConstructor=Hq,this.type="histogram",this.seriesType=MI.bar}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};Vq.type="histogram",Vq.seriesType=MI.bar,Vq.transformerConstructor=Hq;const Nq=()=>{tN(),iN(),nN(),EV(),PV(),ON(),iL.registerTransform("bin",oa),iL.registerChart(Vq.type,Vq)};class Wq extends yq{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}let Uq=class extends bV{constructor(){super(...arguments),this.transformerConstructor=Wq,this.type="circularProgress",this.seriesType=MI.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=Mq}};Uq.type="circularProgress",Uq.seriesType=MI.circularProgress,Uq.transformerConstructor=Wq,G(Uq,CV);const Gq=()=>{tN(),iN(),EV(),PV(),jG(),iL.registerChart(Uq.type,Uq)};class Yq extends yq{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=MI.circularProgress,e}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===MI.gauge||t.type===MI.circularProgress));u(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(u(a.radiusField)&&u(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),u(a.valueField)&&u(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===MI.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:eF.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),u(i.angle.type)&&(i.angle.type="linear"),u(i.radius.type)&&(i.radius.type="linear"),u(i.angle.zIndex)&&(i.angle.zIndex=eF.Region+50)}}let $q=class extends bV{constructor(){super(...arguments),this.transformerConstructor=Yq,this.type="gauge",this.seriesType=MI.gaugePointer}};$q.type="gauge",$q.seriesType=MI.gaugePointer,$q.transformerConstructor=Yq;const Xq=()=>{iN(),bK(),kK(),jG(),iL.registerChart($q.type,$q)};class Kq extends SV{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class qq extends bV{constructor(){super(...arguments),this.transformerConstructor=Kq,this.type="wordCloud",this.seriesType=MI.wordCloud}}qq.transformerConstructor=Kq;let Zq=class extends qq{constructor(){super(...arguments),this.transformerConstructor=Kq,this.type="wordCloud",this.seriesType=MI.wordCloud}};Zq.type="wordCloud",Zq.seriesType=MI.wordCloud,Zq.transformerConstructor=Kq;const Jq=()=>{iN(),X$(),iL.registerChart(Zq.type,Zq)},Qq=()=>{iL.registerGrammarTransform("wordcloudShape",{transform:Y$}),iL.registerGrammarTransform("wordcloud",{transform:A$}),dU(),eY(),iL.registerSeries($$.type,$$),iN(),X$(),iL.registerChart(Zq.type,Zq)};class tZ extends SV{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}let eZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=tZ,this.type="funnel",this.seriesType=MI.funnel}};eZ.type="funnel",eZ.seriesType=MI.funnel,eZ.transformerConstructor=tZ;const iZ=()=>{iN(),gX(),iL.registerChart(eZ.type,eZ)};class sZ extends kV{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=Xz(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=Xz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}let nZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="linearProgress",this.seriesType=MI.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};nZ.type="linearProgress",nZ.seriesType=MI.linearProgress,nZ.transformerConstructor=sZ,G(nZ,CV);const rZ=()=>{tN(),iN(),EV(),PV(),GG(),iL.registerChart(nZ.type,nZ)};class aZ extends kV{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),ZD(t)}}let oZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=aZ,this.type="rangeColumn",this.seriesType=MI.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};oZ.type="rangeColumn",oZ.seriesType=MI.rangeColumn,oZ.transformerConstructor=aZ;const lZ=()=>{tN(),iN(),EV(),PV(),bU(),iL.registerChart(oZ.type,oZ)};class hZ extends SV{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let cZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=hZ,this.type="sunburst",this.seriesType=MI.sunburst}};cZ.type="sunburst",cZ.seriesType=MI.sunburst,cZ.transformerConstructor=hZ;const dZ=()=>{iN(),OX(),iL.registerChart(cZ.type,cZ)};class uZ extends SV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let pZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=uZ,this.type="circlePacking",this.seriesType=MI.circlePacking}};pZ.type="circlePacking",pZ.seriesType=MI.circlePacking,pZ.transformerConstructor=uZ;const gZ=()=>{iN(),jX(),iL.registerChart(pZ.type,pZ)};class fZ extends SV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let mZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="treemap",this.seriesType=MI.treemap}};mZ.type="treemap",mZ.seriesType=MI.treemap,mZ.transformerConstructor=fZ;const vZ=()=>{iN(),cK(),iL.registerChart(mZ.type,mZ)};class yZ extends RN{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),ZD(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}let _Z=class extends IN{constructor(){super(...arguments),this.transformerConstructor=yZ,this.type="waterfall",this.seriesType=MI.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};_Z.type="waterfall",_Z.seriesType=MI.waterfall,_Z.transformerConstructor=yZ;const bZ=()=>{tN(),iN(),nN(),EV(),PV(),VW(),iL.registerChart(_Z.type,_Z)};class xZ extends kV{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),ZD(t)}}let SZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=xZ,this.type="boxPlot",this.seriesType=MI.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};SZ.type="boxPlot",SZ.seriesType=MI.boxPlot,SZ.transformerConstructor=xZ;const kZ=()=>{tN(),iN(),EV(),PV(),hU(),iL.registerTransform("boxplot",la),iL.registerChart(SZ.type,SZ)};class AZ extends SV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let MZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=AZ,this.type="sankey",this.seriesType=MI.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=pD(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}};MZ.type="sankey",MZ.seriesType=MI.sankey,MZ.transformerConstructor=AZ;const wZ=()=>{iN(),$o.load(kw),iK(),iL.registerChart(MZ.type,MZ)};class CZ extends kV{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),ZD(t)}}let TZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=CZ,this.type="rangeArea",this.seriesType=MI.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};TZ.type="rangeArea",TZ.seriesType=MI.rangeArea,TZ.transformerConstructor=CZ;const BZ=()=>{tN(),iN(),nN(),EV(),PV(),AU(),iL.registerChart(TZ.type,TZ)};class PZ extends kV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}let EZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=PZ,this.type="heatmap",this.seriesType=MI.heatmap}};EZ.type="heatmap",EZ.seriesType=MI.heatmap,EZ.transformerConstructor=PZ;const OZ=()=>{iN(),PK(),iL.registerChart(EZ.type,EZ)};class RZ extends SV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let IZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=RZ,this.type="correlation",this.seriesType=MI.correlation}};IZ.type="correlation",IZ.seriesType=MI.correlation,IZ.transformerConstructor=RZ;const LZ=()=>{iN(),UK(),iL.registerChart(IZ.type,IZ)};function DZ(t){var e,i;const s=Object.assign({},t);return E(t.style)||(s.textStyle=uD(t.style)),E(t.textStyle)||eL(s.textStyle,uD(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&uD(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&uD(s.background.style),s}var FZ=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};const jZ=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},zZ=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:TL;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class HZ extends _H{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=eF.Legend,this.layoutLevel=iF.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{bI(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),bI(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=WI(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(W(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new EF(this._option,t),this._initSelectedData(),bI(this._regions,(t=>{t.event.on(yD.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;u(t)||JSON.stringify(n)===JSON.stringify(t)||(bI(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(yD.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)W(s,this._cacheAttrs)||this._legendComponent.setAttributes(eL({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(eL({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t,this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());W(t,this._cacheAttrs)||this._legendComponent.setAttributes(eL({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(yD.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}HZ.specKey="legends";class VZ extends HZ{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return xj(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),bI(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:FD.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){MD(this._option.dataSet,"discreteLegendFilter",zZ),MD(this._option.dataSet,"discreteLegendDataMake",jZ);const t=new so(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return bI(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!ix(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=ZL(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=Object.assign(Object.assign({layout:e,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,e){const i=FZ(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:s={},item:n={},pager:r={},background:a={}}=t;s=L(s),n=L(n),r=L(r),a=L(a);const o=i;return s.visible?o.title=DZ(s):o.title={visible:!1},E(n.focusIconStyle)||uD(n.focusIconStyle),n.shape&&(n.shape=hD(n.shape)),n.label&&(n.label=hD(n.label)),n.value&&(n.value=hD(n.value)),n.background&&(n.background=hD(n.background)),UI(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),UI(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),UI(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),o.item=n,"scrollbar"===r.type?(E(r.railStyle)||uD(r.railStyle),E(r.sliderStyle)||uD(r.sliderStyle)):(E(r.textStyle)||uD(r.textStyle),r.handler&&hD(r.handler)),o.pager=r,a.visible&&!E(a.style)&&(eL(o,a.style),p(a.padding)&&(o.padding=a.padding)),o}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return TR}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(xR.legendItemClick,(e=>{const i=O(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(yD.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(xR.legendItemHover,(t=>{const e=O(t,"detail");this.event.emit(yD.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(xR.legendItemUnHover,(t=>{const e=O(t,"detail");this.event.emit(yD.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=bj(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=bj(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}VZ.specKey="legends",VZ.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},VZ.type=r.discreteLegend;const NZ=()=>{iL.registerComponent(VZ.type,VZ)},WZ=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;A(n)&&(t=Math.min(n,t)),A(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},UZ=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!E(o)){const[e,i]=o;return a?a(t,o,l):h(t)?lD(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};var GZ=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};const YZ={color:RR,size:LR},$Z={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},XZ=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},$Z),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},KZ={horizontal:XZ(!0),vertical:XZ(!1)},qZ=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},$Z),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},ZZ={horizontal:qZ(!0),vertical:qZ(!1)},JZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],QZ=[2,10];let tJ=class extends HZ{static getSpecInfo(t){const e=xj(t,this.specKey,this.type,(t=>function(t){return"color"===t||"size"===t}(t.type)));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),bI(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:FD.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){MD(this._option.dataSet,"continuousLegendFilter",UZ),MD(this._option.dataSet,"continuousLegendDataMake",WZ);const t=new so(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>xI(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=ZL(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!ix(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=ZL(this._option.dataSet.getDataView(a.dataId),a.fields[0])}}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),E(r)&&(r="color"===this._legendType?JZ:QZ);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},function(t){const e=eL({},t),{title:i={},handler:s={},rail:n={},track:r={},startText:a,endText:o,handlerText:l,sizeBackground:h,background:c={},type:d,id:u,visible:g,orient:f,position:m,data:v,defaultSelected:y,field:_,filter:b,regionId:x,regionIndex:S,seriesIndex:k,seriesId:A,padding:M}=e,w=GZ(e,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return i.visible?w.title=DZ(i):w.title={visible:!1},w.showHandler=!1!==s.visible,E(s.style)||(w.handlerStyle=uD(s.style)),p(n.width)&&(w.railWidth=n.width),p(n.height)&&(w.railHeight=n.height),E(n.style)||(w.railStyle=uD(n.style)),E(r.style)||(w.trackStyle=uD(r.style)),w.startText=hD(a),w.endText=hD(o),w.handlerText=hD(l),E(h)||(w.sizeBackground=uD(h)),c.visible&&!E(c.style)&&(eL(w,c.style),p(c.padding)&&(w.padding=c.padding)),w}(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return YZ[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((e=>{const i=O(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(yD.legendFilter,{model:this,value:i,event:e})}),30))}}};tJ.specKey="legends",tJ.builtInTheme={colorLegend:KZ,sizeLegend:ZZ},tJ.type=r.continuousLegend;const eJ=()=>{iL.registerComponent(tJ.type,tJ)},iJ=(t,e)=>p(e)?t.map((t=>e[t])):void 0,sJ=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),nJ=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);const rJ=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=iJ(c,t);let y=iJ(d,t);const _=nJ(y),b=!_&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(sJ(c,v));if(!_&&(y=iJ(d,i),!nJ(y)))return;const n=e.type===MI.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=hP(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(sJ(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=iJ(d,o),!nJ(y))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(sJ(c,n));if(!_&&(y=iJ(d,r),!nJ(y)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===MI.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(sJ(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=iJ(d,i),!nJ(y))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var t,i;const n=null===(i=null===(t=e.getMapViewData)||void 0===t?void 0:t.call(e))||void 0===i?void 0:i.latestData.find((t=>c.every(((e,i)=>t.properties[e]===(null==v?void 0:v[i])))));let r=y;if(!_){if(y=iJ(d,n),r=y,!nJ(y)&&!n)return;y=Object.assign({},n.properties)}const a=e.type===MI.pie?e.dataToCentralPosition(n.properties):e.dataToPosition(n.properties);u(a)||isNaN(a.x)||isNaN(a.y)||s.push({pos:a,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:r,hasMeasureData:_,groupField:g,groupData:f,originDatum:n},series:e})})()})),s},aJ=t=>p(t)&&!_(t),oJ=t=>p(t)&&_(t);class lJ extends fH{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=eL({},this._theme,r.style),r.offset=eL({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:Jb(this._option.mode)||!qb(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=o_.getElementById(t.parentElement)):qb(this._option.mode)&&(t.parentElement=null==Kb?void 0:Kb.body)}}let hJ=class extends _H{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=lJ,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=qb(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s<n;s++){const n=a[s],o=!!this.processor[n]&&this._showTooltipByMouseEvent(n,i,t,e);if("unShowByOption"===o)r[n]="unShowByOption";else if(o){r[n]=!0;break}}Object.values(r).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&aJ(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&mj.globalConfig.uniqueTooltip&&l&&mj.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(yD.tooltipHide,Object.assign(Object.assign({},t),{source:_D.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:_D.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(yD.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(yD.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?KV.canvas:KV.dom,n=iL.getComponentPluginInType(t);n||Yb("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=iL.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(Zb(s)||Jb(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))})),i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,St(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=function(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=rJ(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>sJ(i,s)(t)&&sJ(n,r)(t)&&(u(a)||sJ([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),k=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:_D.chart,event:k({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return mj.globalConfig.uniqueTooltip&&mj.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:_D.chart,event:k(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return mj.globalConfig.uniqueTooltip&&mj.hideTooltip(a.id),m}return"none"}(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(oJ(t)){if(aJ(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>_z(t,e[i])))}if(oJ(this._cacheInfo))return!1;const s=this._cacheInfo;if((null==t?void 0:t.datum)!==s.datum||(null==t?void 0:t.mark)!==s.mark||(null==t?void 0:t.series)!==s.series)return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&n.mark===e.mark&&n.model===e.model&&n.datum===e.datum}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}};hJ.type=r.tooltip,hJ.transformerConstructor=lJ,hJ.builtInTheme={tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}}},hJ.specKey="tooltip";const cJ=()=>{iL.registerComponent(hJ.type,hJ)};var dJ;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(dJ||(dJ={}));var uJ=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};const pJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class gJ extends _H{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=eF.CrossHair_Grid,this.labelZIndex=eF.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{hP(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||W(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:bD.chart}:{source:_D.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:t=n["desktop-browser"]}=this._option,e=function(t){return t===n["desktop-browser"]||t===n["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Zb(t)||Jb(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=Y(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(yD.tooltipHide,{source:_D.chart},this._handleTooltipHideOrRelease),this.event.on(yD.tooltipShow,{source:_D.chart},this._handleTooltipShow),this.event.on(yD.tooltipRelease,{source:_D.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=O(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{pJ[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,e){var i,s,n;const r={},{line:a={},label:o={},visible:l}=t;if(r.visible=l,r.type=a.type||"line",!1===a.visible)r.style={visible:!1};else{const e=a.style||{},{stroke:n,fill:o,lineWidth:l}=e,h=e,{strokeOpacity:c,fillOpacity:d,opacity:u}=h,p=uJ(h,["strokeOpacity","fillOpacity","opacity"]),g="line"===r.type;let f=g?c:d;if(S(u)&&(f=(null!=f?f:1)*u),r.style=Object.assign({opacity:f,pickable:!1,visible:!0},p),g)r.style.stroke=n||o,r.style.lineWidth=O(a,"width",l||2);else{r.style.fill=o||n,(null===(s=null===(i=null==t?void 0:t.line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.stroke)&&(r.style.stroke=t.line.style.stroke);const e=O(a,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;r.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(r.style.size=e)}}if(o.visible){const t=o.labelBackground||{},e=null!==(n=o.syncAxisLabelAngle)&&void 0!==n&&n,i=o.style||{},s=t.style||{},{fill:a="rgba(47, 59, 82, 0.9)",stroke:l,outerBorder:h}=s,d=uJ(s,["fill","stroke","outerBorder"]);r.label={visible:!0,formatMethod:o.formatMethod,formatter:o.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:e,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:O(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:a,stroke:l,outerBorder:Object.assign({stroke:a,distance:0,lineWidth:3},h)},d):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else r.label={visible:!1};return r}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;if(a=e,o=i,((r=s).x1>a||r.x2<a||r.y1>o||r.y2<o)&&t.delete(n.getSpecIndex()),n.type.startsWith("polarAxis")){const s=n.getCenter(),r=n.getInnerRadius(),a=n.getOuterRadius(),o=ae.distancePP({x:e,y:i},s);(o>a||o<r)&&t.delete(n.getSpecIndex())}var r,a,o})),t}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new Kw(e),null==s||s.add(t),i(t)),function(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;a<i&&(u=i-a),o<s&&(p=s-o),l>n&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}gJ.specKey="crosshair";const fJ={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class mJ extends gJ{static getSpecInfo(t){return xj(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=cz(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){cz(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:dz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=SI(this._regions,"cartesian");e&&(HV(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=WV(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new gC(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new fC(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}mJ.specKey="crosshair",mJ.builtInTheme={crosshair:fJ},mJ.type=r.cartesianCrosshair;const vJ=()=>{iL.registerComponent(mJ.type,mJ)};class yJ extends gJ{static getSpecInfo(t){return xj(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=SI(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=$z(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=bj(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=vt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new gC(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new vC(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else e="polygon"==(c?"circle":"polygon")?new yC(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new mC(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}));this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}yJ.specKey="crosshair",yJ.builtInTheme={crosshair:fJ},yJ.type=r.polarCrosshair;const _J=()=>{iL.registerComponent(yJ.type,yJ)},bJ=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},xJ=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},SJ=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),(f?g:!1===r||m?g.sort(((t,e)=>t-e)):c).forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},kJ=(t,e,i)=>{const s=e.domain();if(oP(e.type))return i?s[0]+($(s)-s[0])*(1-t):s[0]+($(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+($(n)-n[0])*t;return e.invert(r)},AJ=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&oP(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/($(n)-n[0])))},MJ=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},wJ=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},CJ=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),TJ=(t,e,i)=>{if(oP(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class BJ{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=vt(this.getState().start+f,0,1),y=vt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Wt(s/n)>=.5:Wt(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===gz(pz(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(BJ,aW);class PJ extends _H{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:AJ(t,this._stateScale,this._isHorizontal),a="percent"===n?e:AJ(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var t;this._dataFilterEvent.initZoomEvent(),null===(t=this._relatedAxisComponent)||void 0===t||t.event.on(yD.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-t<this._minSpan||e-t>this._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=MJ(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=TJ(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&wJ(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else bI(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),bI(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=pz(t),this._isHorizontal="horizontal"===gz(this._orient),this._dataFilterEvent=new BJ(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||W(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(oP(n.type)){const r=n.domain(),a=r[0],o=$(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>gz(t._orient)===gz(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!oP(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}}_initData(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};bI(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=oP(d.getScale(0).type),p=oP(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else bI(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:r}=this._option;wD(r,"dataview",za),MD(r,"dataFilterComputeDomain",SJ);const a=new so(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new EF(this._option,a),a.reRunAllTransform(),r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(MD(this._option.dataSet,"dataFilterWithNewDomain",xJ),MD(this._option.dataSet,"lockStatisticsFilter",bJ),bI(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>oP(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>oP(this._stateScale.type)},level:FD.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(oP(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!W(this._domainCache,e)&&(this._domainCache=e,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;CJ("start",i,this._spec)&&CJ("end",s,this._spec)&&(t="percent"===i?this._spec.start:AJ(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:AJ(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?AJ(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?AJ(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=kJ(this._start,this._stateScale,MJ(i,this._isHorizontal)),this._endValue=kJ(this._end,this._stateScale,MJ(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,oP(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=TJ(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&bI(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);A(null==i?void 0:i.min)&&A(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new QP:new OP,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:sF.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=wJ(h);if(!this._dataUpdating&&hP(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,hP(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=!(u(t)&&u(e)||0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(PJ,aW);class EJ extends fH{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=eL({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const OJ=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),RJ={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},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}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:OJ(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:OJ(!0)};let IJ=class extends PJ{constructor(t,e){var i;super(t,e),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=EJ,this.specKey="dataZoom",this.layoutZIndex=eF.DataZoom,this.layoutLevel=iF.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange)if(i&&this._component)this._component.setStartAndEnd(t,e);else{const i=this._relatedAxisComponent,n=kJ(t,this._stateScale,MJ(i,this._isHorizontal)),r=kJ(e,this._stateScale,MJ(i,this._isHorizontal));if(!p(n)||!p(r))return;this._start=t,this._end=e,(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(yD.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new QP),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(MJ(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=MJ(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new QP;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(MJ(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return!(oP(t.type)&&e[0]===$(e)||hP(t.type)&&1===(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:MJ(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=this._isHorizontal?this._stateScale:this._valueScale,i=this._isHorizontal?this._valueScale:this._stateScale,s=this._isScaleValid(e)&&this._isScaleValid(i)&&!1!==this._spec.showBackgroundChart,n=this._getAttrs(s),r=this._relatedAxisComponent;if(this._component)this._component.setAttributes(n),t&&(this._component.setPreviewData(this._data.getDataView().latestData),s&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>kJ(t,this._stateScale,MJ(r,this._isHorizontal))))));else{const t=this.getContainer();this._component=new SO(n),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?s&&this._component.setPreviewPointsY1(this._dataToPositionY2):s&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>kJ(t,this._stateScale,MJ(r,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:uD(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:uD(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:uD(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:uD(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:uD(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:uD(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:uD(g.style)},selectedBackgroundStyle:uD(this._spec.selectedBackground.style),dragMaskStyle:uD(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:eL(uD(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},uD(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:eL(uD(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},uD(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=bj(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(MJ(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}};IJ.type=r.dataZoom,IJ.transformerConstructor=EJ,IJ.builtInTheme={dataZoom:RJ},IJ.specKey="dataZoom";const LJ=()=>{iL.registerComponent(IJ.type,IJ)};let DJ=class extends PJ{constructor(t,e){var i;super(t,e),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=eF.DataZoom,this.layoutLevel=iF.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}_handleChange(t,e,i){super._handleChange(t,e,i);const s=dI(this._start,t)&&dI(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=kJ(t,this._stateScale,!1),n=kJ(e,this._stateScale,!1);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(s,n))&&this.event.emit(yD.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._spec.auto&&this._data.getDataView().reRunAllTransform()}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new _w(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),E(null==t?void 0:t.style)||(s.railStyle=uD(t.style)),E(null==e?void 0:e.style)||(s.sliderStyle=uD(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}};DJ.type=r.scrollBar,DJ.builtInTheme={scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},DJ.specKey="scrollBar";const FJ=()=>{iL.registerComponent(DJ.type,DJ)},jJ=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},zJ=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),HJ={title:{visible:!0,autoLimit:!1,autoFit:!1,style:zJ("l1FontSize","primaryFontColor")},content:{visible:!0,style:zJ("l2FontSize","tertiaryFontColor")}};var VJ=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};let NJ=class extends _H{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=eF.Indicator,this.layoutLevel=iF.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return xj(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}initEvent(){this._option.disableTriggerEvent||"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(pD(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(pD(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){MD(this._option.dataSet,"indicatorFilter",jJ);const t=new so(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new EF(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:s,y:n}=t.getLayoutStartPoint(),r=this._spec,{content:a,offsetX:o,offsetY:l,limitRatio:h,title:c}=r,d=VJ(r,["content","offsetX","offsetY","limitRatio","title"]),u=[];return Y(a).forEach((t=>{const e=eL({},this._theme.content,t);u.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},dD(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:e,height:i},zIndex:this.layoutZIndex,x:s,y:n,dx:o?KI(o,this._computeLayoutRadius()):0,dy:l?KI(l,this._computeLayoutRadius()):0,limitRatio:h||1/0,title:{visible:!1!==c.visible&&(!p(c.field)||null!==this._activeDatum),space:c.space||this._gap,autoLimit:c.autoLimit,autoFit:c.autoFit,fitPercent:c.fitPercent,fitStrategy:c.fitStrategy,style:Object.assign(Object.assign({},dD(H(c.style,["text"]),this._activeDatum)),{text:this._createText(c.field,c.style.text)})},content:u},d)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)W(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new jR(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}};NJ.type=r.indicator,NJ.builtInTheme={indicator:HJ},NJ.specKey="indicator";const WJ=()=>{iL.registerComponent(NJ.type,NJ)},UJ=["sum","average","min","max","variance","standardDeviation","median"];var GJ=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};function YJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return e<n||e>r}function $J(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&YJ(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=UI(t.x)?ZJ(t.x,n)+r.x:JJ(l.getXAxisHelper(),[t.x])+r.x,h}function XJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&YJ(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=UI(t.y)?ZJ(t.y,n)+r.y:JJ(l.getYAxisHelper(),[t.y])+r.y,h}function KJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&YJ(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),JJ(a.angleAxisHelper,[t.angle])}function qJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&YJ(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),JJ(a.radiusAxisHelper,[t.radius])}function ZJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function JJ(t,e){const i=t.getScale(0);return oP(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function QJ(t){return UJ.includes(t)}function tQ(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),y=m.getScale(0).domain(),_=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},k={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=$J(t,y,n,u,c,o),r=XJ(t,_,n,u,d,o),eQ(s,b,S,g.length),eQ(r,x,k,g.length),g.push([{x:s,y:r}]);else if(e){s=$J(t,y,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);eQ(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=XJ(t,_,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);eQ(r,x,k,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,k),g}function eQ(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value<t)&&(i.max={value:t,index:s})),t}function iQ(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=KJ(t,l,n,r),i=qJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=KJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=qJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function sQ(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}function nQ(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=_(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=UI(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=UI(i)?Number(i.substring(0,i.length-1))*f/100:i)}const y=d.getXAxisHelper().getScale(0).domain(),_=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&YJ(y,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&YJ(_,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:JJ(d.getXAxisHelper(),b)+p.x+m,y:JJ(d.getYAxisHelper(),x)+p.y+v})})),n}function rQ(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&YJ(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&YJ(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:JJ(l.angleAxisHelper,d),radius:JJ(l.radiusAxisHelper,u)})})),s}function aQ(t,e,i){let{x:s,y:n}=t;return UI(s)&&(s=ZJ(s,e)),UI(n)&&(n=ZJ(n,i)),{x:s,y:n}}function oQ(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=aQ(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>aQ(t,n,r)))}function lQ(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.x<e&&(e=r.x),r.x+a.width>i&&(i=r.x+a.width),r.y<s&&(s=r.y),r.y+a.height>n&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function hQ(t,e,i){const{labelBackground:s={},style:n,shape:r}=t,a=GJ(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=a;return(null==r?void 0:r.visible)?t.shape=Object.assign({visible:!0},uD(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0,customShape:s.customShape},dQ(uD(s.style),e,i)),p(s.padding)&&(t.padding=ui(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=dQ(uD(n),e,i)),t}return{visible:!1}}function cQ(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function dQ(t,e,i){return d(t)?t(e,i):t}function uQ(t,e){return d(t)?t(e):t}function pQ(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function gQ(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function fQ(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=gQ(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function mQ(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=gQ(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function vQ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}var yQ=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};function _Q(t,e){let i;if(e.coordinates){const t=e,{coordinates:s,coordinateType:n,getSeriesByIdOrIndex:r}=t,a=yQ(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let o,l;if(d(s)){const t=e.getRelativeSeries();o=s(t.getData().getLatestData(),t)}else o=s;o=Y(o),i=o.map((t=>{const e=r(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===n){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:o,yFieldIndex:h}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(h)&&(d=Y(s)[h]),o&&Y(s).includes(o)&&(d=o),l=Object.assign({x:void 0,y:void 0},a),y(t[c])&&QJ(t[c])?l.x={field:c,aggrType:t[c]}:l.x=Y(c).map((e=>t[e])),y(t[d])&&QJ(t[d])?l.y={field:d,aggrType:t[d]}:l.y=Y(d).map((e=>t[e]))}else if("polar"===n){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let o=s;p(r)&&(o=Y(s)[r]),n&&Y(s).includes(n)&&(o=n);const h=i;l=Object.assign({angle:void 0,radius:void 0},a),y(t[o])&&QJ(t[o])?l.angle={field:o,aggrType:t[o]}:l.angle=Y(o).map((e=>t[e])),y(t[h])&&QJ(t[h])?l.radius={field:h,aggrType:t[h]}:l.radius=Y(h).map((e=>t[e]))}return l.getRefRelativeSeries=()=>e,l}))}else i=e;const s=[];return i.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>xQ(i,t,e))):i.x=xQ(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>xQ(i,t,e))):i.y=xQ(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>xQ(i,t,e))):i.angle=xQ(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>xQ(i,t,e))):i.radius=xQ(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=xQ(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),s.push(i)})),s}const bQ={min:(t,e)=>uI(t[0].latestData,e.field),max:(t,e)=>pI(t[0].latestData,e.field),sum:function(t,e){return gI(t[0].latestData,e.field)},average:function(t,e){return fI(t[0].latestData,e.field)},variance:function(t,e){return mI(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(mI(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function xQ(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(m(t)){const{aggrType:i,field:s}=t;return bQ[i](e,{field:s})}return t}function SQ(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class kQ extends _H{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return xj(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){return y(e)&&QJ(e)?{field:i.getSpec()[{x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"}[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new io;return e.registerParser("array",s),new so(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=SI(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=GI(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=GI(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return W(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();MD(this._option.dataSet,"markerAggregation",_Q),MD(this._option.dataSet,"markerFilter",SQ);const i=new so(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function AQ(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=uI(t,e),r=pI(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class MQ extends kQ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=eF.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=fQ(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:dQ(uD(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>hQ(t,this._markerData,this._markAttributeContext))),state:{line:cQ(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:cQ(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:cQ(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return cQ(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return cQ(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:dQ(uD(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:dQ(uD(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1},this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=lQ([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=fQ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;MD(this._option.dataSet,"markerAggregation",_Q),MD(this._option.dataSet,"markerRegression",AQ),MD(this._option.dataSet,"markerFilter",SQ);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new so(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}MQ.specKey="markLine";const wQ=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),CQ={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},TQ={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:wQ(!1),endSymbol:wQ(!0),label:CQ};class BQ extends MQ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new oR(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:y}=fQ(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=tQ(i,s,n,r,d);_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=nQ(i,r,d,e.coordinatesOffset):c&&(_=oQ(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(UI(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),y=Y(r.label),_=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:y.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=_[e])&&void 0!==n?n:_[0];return A(null==c?void 0:c.refX)&&(a+=c.refX),A(null==c?void 0:c.refY)&&(o+=c.refY),A(null==c?void 0:c.dx)&&(l+=c.dx),A(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=fQ(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new so(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}BQ.type=r.markLine,BQ.coordinateType="cartesian",BQ.builtInTheme={markLine:TQ};const PQ=()=>{iL.registerComponent(BQ.type,BQ),aR()};class EQ extends MQ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=fQ(this._spec);return e||i?new cR(t):new oR(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=fQ(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=iQ(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=rQ(i,r,a),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=fQ(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}EQ.type=r.polarMarkLine,EQ.coordinateType="polar",EQ.builtInTheme={polarMarkLine:TQ};const OQ=()=>{iL.registerComponent(EQ.type,EQ),cR._animate=VO,aR()};let RQ=class extends _H{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=eF.Title,this.layoutLevel=iF.Title,this._orient="top",this._orient=WI(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return xj(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){A(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),A(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:A(t.width())?t.width():0,height:this._spec.height?this._spec.height:A(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o;if(!1===this._spec.visible)return{visible:!1};const l=this.getLayoutRect(),h=GI(this._spec.width,l.width,null,l.width),c=GI(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtextType:null!==(i=this._spec.subtextType)&&void 0!==i?i:"text",subtext:null!==(s=this._spec.subtext)&&void 0!==s?s:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(r=this._spec.y)&&void 0!==r?r:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:d,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(a=this._spec.align)&&void 0!==a?a:"left",verticalAlign:null!==(o=this._spec.verticalAlign)&&void 0!==o?o:"top",textStyle:Object.assign({width:d,maxLineWidth:d},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:d},this._spec.subtextStyle)});return p(this._spec.width)&&(u.textStyle.width=Math.max(h,l.width),u.subtextStyle.width=u.textStyle.width),u}_createOrUpdateTitleComponent(t){if(this._titleComponent)W(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new DR(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}};RQ.type=r.title,RQ.specKey=r.title,RQ.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};const IQ=()=>{iL.registerComponent(RQ.type,RQ)};class LQ extends kQ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=eF.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=mQ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:dQ(uD(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>hQ(t,this._markerData,this._markAttributeContext))),state:{area:cQ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>cQ(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return cQ(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=lQ([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=mQ(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}LQ.specKey="markArea";const DQ={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class FQ extends LQ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new hR(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=mQ(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=tQ(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=tQ(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=nQ(s,a,u,i.coordinatesOffset):d&&(f=oQ(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=mQ(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}FQ.type=r.markArea,FQ.coordinateType="cartesian",FQ.builtInTheme={markArea:DQ};const jQ=()=>{iL.registerComponent(FQ.type,FQ),lR()};class zQ extends LQ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=mQ(this._spec);return i||e||s?new dR(t):new hR(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=mQ(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=iQ(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=rQ(i,r,c),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=mQ(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}zQ.type=r.polarMarkArea,zQ.coordinateType="polar",zQ.builtInTheme={polarMarkArea:DQ};const HQ=()=>{iL.registerComponent(zQ.type,zQ),dR._animate=WO,lR()},VQ=t=>uD(Object.assign({},t)),NQ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},uD(t.style))}),WQ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=VQ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=VQ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),y=(A=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},uD(Object.assign({},A))),_=NQ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),b=NQ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),x=NQ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),S=NQ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:y}),controller:Object.assign(Object.assign({},t.controller),{start:_,pause:b,backward:x,forward:S})});var A;return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},UQ=t=>"left"===t||"right"===t,GQ=t=>"top"===t||"bottom"===t;let YQ=class extends _H{constructor(){super(...arguments),this.layoutZIndex=eF.Player,this.layoutLevel=iF.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},WQ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},WQ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?W(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new JR(t):this._playerComponent=new eI(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=UQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=UQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(yD.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(YR.end,(()=>{var t;this.event.emit(yD.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(YR.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(YR.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(yD.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(YR.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(yD.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(YR.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(yD.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(YR.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(yD.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),A(t.x)){const e=UQ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(A(t.y)){const e=GQ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):UQ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):GQ(this._orient)?this._maxSize():t.height}_computeDx(t){return UQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return GQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];this._option.globalInstance.updateFullData(e.data),this.event.emit(yD.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}};YQ.builtInTheme={player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}}},YQ.specKey="player",YQ.type=r.player;const $Q=()=>{iL.registerComponent(YQ.type,YQ)};class XQ extends _H{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=eF.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,W(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=RI({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==SF.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}XQ.type=r.label;class KQ extends cU{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}KQ.type="text",KQ.constructorType="label";const qQ=()=>{dU(),iL.registerMark(KQ.constructorType,KQ)};class ZQ extends fH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class JQ extends XQ{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=ZQ,this.layoutZIndex=eF.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[];return((null==e?void 0:e.region)||[]).forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(yD.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(mD.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(mD.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),bI(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n<i.length;n++){const r=i[n],a=t.getMarkInName(r);a&&e[r].forEach(((e,i)=>{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n),d(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",sF.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=eL({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},PW(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[HL])):t=>t.filter((t=>t.data[zL]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?EW(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}JQ.type=r.label,JQ.specKey="label",JQ.transformerConstructor=ZQ;const QQ=()=>{iL.registerGraphicComponent(JQ.type,(t=>new nO(t))),qQ(),xH(),iL.registerComponent(JQ.type,JQ,!0,1/0)};class t0 extends XQ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=eF.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[FL]},"normal",sF.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return eL({textStyle:{pickable:!0===this._spec.interactive},position:e0(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[HL]:t.data[zL]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>EW({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function e0(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}t0.type=r.totalLabel,t0.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},t0.specKey="totalLabel";const i0=()=>{iL.registerGraphicComponent(t0.type,(t=>new nO(t))),qQ(),xH(),iL.registerComponent(t0.type,t0,!0)};var s0=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};class n0 extends kQ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=eF.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=vQ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,k,A,M,w,C,T,B,P,E,O;const{itemContent:R={},itemLine:I={},targetSymbol:L={}}=this._spec,D=R,{type:F="text",text:j,symbol:H,image:V,richText:N,customMark:W,textStyle:U,symbolStyle:G,imageStyle:Y,richTextStyle:$,customMarkStyle:X,style:K={},state:q={}}=D,Z=s0(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(t=null==j?void 0:j.state)&&void 0!==t?t:q,tt={dx:0,dy:0},Q=hQ(Object.assign(Object.assign({},j),{style:z(tt,null!==(i=null!==(e=null==j?void 0:j.textStyle)&&void 0!==e?e:U)&&void 0!==i?i:K)}),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=dQ(z(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:$)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=uD(dQ(z(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=dQ(z(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==W?void 0:W.state)&&void 0!==u?u:q,Q=dQ(null!==(g=null!==(p=null==W?void 0:W.style)&&void 0!==p?p:X)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(y=this._spec.clip)&&void 0!==y&&y,itemContent:Object.assign(Object.assign({type:F,offsetX:uQ(R.offsetX,this._relativeSeries.getRegion()),offsetY:uQ(R.offsetX,this._relativeSeries.getRegion())},Z),{style:dQ(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(_=L.offset)&&void 0!==_?_:0,visible:null!==(b=L.visible)&&void 0!==b&&b,size:null!==(x=L.size)&&void 0!==x?x:20,style:dQ(L.style,this._markerData,this._markAttributeContext)},state:{line:cQ(null!==(k=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),lineStartSymbol:cQ(null!==(M=null===(A=this._spec.itemLine.startSymbol)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:cQ(null!==(C=null===(w=this._spec.itemLine.endSymbol)||void 0===w?void 0:w.state)&&void 0!==C?C:{},this._markerData,this._markAttributeContext),itemContent:cQ(J,this._markerData,this._markAttributeContext),textBackground:cQ(null===(B=null===(T=this._spec.itemContent.text)||void 0===T?void 0:T.labelBackground)||void 0===B?void 0:B.state,this._markerData,this._markAttributeContext),targetItem:cQ(null!==(E=null===(P=this._spec.targetSymbol)||void 0===P?void 0:P.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=I,nt=s0(I,["visible","line"]);return et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:uD(st.style)}):{visible:!1},new pR(et)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=lQ([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:pQ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:pQ(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=vQ(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}n0.specKey="markPoint";const r0={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class a0 extends n0{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=tQ(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=nQ(n,r,h,s.coordinatesOffset)[0]:l&&(c=oQ(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=vQ(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}a0.type=r.markPoint,a0.coordinateType="cartesian",a0.builtInTheme={markPoint:r0};const o0=()=>{iL.registerComponent(a0.type,a0),uR()};class l0 extends n0{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=iQ(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}l0.type=r.polarMarkPoint,l0.coordinateType="polar",l0.builtInTheme={polarMarkPoint:r0};const h0=()=>{iL.registerComponent(l0.type,l0),uR()};class c0 extends n0{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){return{point:sQ(this._markerData,this._relativeSeries)[0][0]}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}c0.type=r.geoMarkPoint,c0.coordinateType="geo",c0.builtInTheme={geoMarkPoint:r0};const d0=()=>{iL.registerComponent(c0.type,c0),uR()};let u0=class extends _H{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=eF.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return xj(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),"inBrush",sF.Series),i.setMarkStyle(s,Object.assign({},e),"outOfBrush",sF.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return W(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;super.onLayoutEnd(),this._option.disableTriggerEvent||(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new rI(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:uD(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(QR.brushActive,(i=>{this._initMarkBrushState(e,"outOfBrush"),this._emitEvent(yD.brushActive,t)})),r.addEventListener(QR.drawStart,(e=>{this._setRegionMarkPickable(t,!0),this._emitEvent(yD.brushStart,t)})),r.addEventListener(QR.moveStart,(e=>{this._setRegionMarkPickable(t,!0),this._emitEvent(yD.brushStart,t)})),r.addEventListener(QR.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(yD.brushChange,t)})),r.addEventListener(QR.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(yD.brushChange,t)})),r.addEventListener(QR.brushClear,(i=>{this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(yD.brushClear,t)})),r.addEventListener(QR.drawEnd,(i=>{var s;this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(yD.brushClear,t)):(this._spec.onBrushEnd(i),this._emitEvent(yD.brushEnd,t));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(yD.brushEnd,t)}})),r.addEventListener(QR.moveEnd,(e=>{this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec,n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(yD.brushEnd,t)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},uD(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState("inBrush",!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState("inBrush"),i.addState("outOfBrush",!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState("inBrush",!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState("inBrush"),i.addState("outOfBrush",!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i<e.length;i++){if(Fe(t,e[i].x,e[i].y))return!0;if(i>0&&De(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState("inBrush"),s.removeState("outOfBrush"),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?"width":"height",p=r?o:h,g=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=(p-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],n=(g-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],r=this._stateClamp(s-a),o=this._stateClamp(n+a);i.setStartAndEnd(Math.min(r,o),Math.max(r,o),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:r,end:o,startValue:kJ(r,i.stateScale,MJ(i.relatedAxisComponent,i.isHorizontal)),endValue:kJ(o,i.stateScale,MJ(i.relatedAxisComponent,i.isHorizontal))})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i)<i[0],o=p-e.getLayoutStartPoint()[d],l=g-e.getLayoutStartPoint()[d],h=r?Math.min(o,l):Math.max(o,l),c=r?Math.max(o,l):Math.min(o,l),u=(c-i[0])/($(i)-i[0])*(s[1]-s[0])+s[0],f=(h-i[0])/($(i)-i[0])*(s[1]-s[0])+s[0],m=this._stateClamp(u-a),v=this._stateClamp(f+a);t.scaleRangeFactor([m,v]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:m,end:v,startValue:t.getScale().invert(c),endValue:t.getScale().invert(h)})}}))}}_getNeedClearVRenderComponents(){return this._brushComponents}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}};u0.type=r.brush,u0.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},u0.specKey="brush";const p0=()=>{iL.registerComponent(u0.type,u0)};class g0 extends _H{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=eF.CustomMark,this.layoutLevel=iF.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${kL}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=Zj({},Jj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||A(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return W(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new $e).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new $e;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}g0.type=r.customMark,g0.specKey="customMark";const f0=()=>{iL.registerComponent(g0.type,g0)};class m0{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(A(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)&&(null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0;return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r<t[e]+(null!==(i=t[`${e}Span`])&&void 0!==i?i:1);r++)n+=s[r].value;return n}getSizeFromUser(t,e){var i,s;const n="col"===e?this._colSize:this._rowSize;if(!(null===(i=n[t[e]])||void 0===i?void 0:i.isUserSetting))return;let r=0;for(let i=t[e];i<t[e]+(null!==(s=t[`${e}Span`])&&void 0!==s?s:1);i++){if(!n[i].isUserSetting)return;r+=n[i].value}return r}setItemLayoutSizeToGrid(t,e){if(v0(t)){if(e.colSpan&&e.colSpan>1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;t<e.col;t++)i.x+=this._colSize[t].value;for(let t=0;t<e.row;t++)i.y+=this._rowSize[t].value;return i.x+=t.layoutPaddingLeft+t.layoutOffsetX,i.y+=t.layoutPaddingTop+t.layoutOffsetY,i}getItemLayoutRect(t){var e,i;const s=this.getItemGridInfo(t);return{width:(null!==(e=this.getSizeFromGrid(s,"col"))&&void 0!==e?e:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(i=this.getSizeFromGrid(s,"row"))&&void 0!==i?i:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom}}layoutItems(t,e,i,s){this._chartLayoutRect=i,this._chartViewBox=s,this.clearLayoutSize(),e.sort(((t,e)=>e.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>v0(t))),a=n.filter((t=>!v0(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>v0(t))),h=o.filter((t=>!v0(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);A(h.width)||(h.width=l.width),A(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function v0(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}m0.type="grid";const y0=()=>{$o.load(uC)},_0="vchart-tooltip",b0=`${_0}-container`,x0=`${_0}-title`,S0=`${_0}-content-box`,k0={offsetX:10,offsetY:10},A0="99999999999999";function M0(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\(/g,"(").replace(/ /g," ")}const w0=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,C0=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?M0(t):"",T0=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},B0={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},P0=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=B0[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class E0 extends Uz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:k,offsetY:M}=this._option,w=m[_],C=Mj(null==w?void 0:w.position,b,e),T=null!==(r=Mj(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:B=0,height:P=0}=null!=i?i:{},E="canvas"===m.renderMode,O=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==O?void 0:O.width)&&void 0!==o?o:AL,I=null!==(l=null==O?void 0:O.height)&&void 0!==l?l:ML;let L=!1;const D={width:0,height:0};let F,j={x:0,y:0},z={x:0,y:0},H=1,V=1;const N=qb(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=I),N&&!E){const t=this._getParentElement(m);z=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),j={x:F.x-z.x,y:F.y-z.y},H=w0(e,F),V=w0(t,z)}const W=V/H,U={},G={x:C,y:C},Y={x:["left","right"],y:["top","bottom"]},$=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?k:M;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:P;switch(P0(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},X=["x","y"];if(g(C))if(g(K=C)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=C;U.left=T0(t,y),U.top=T0(i,y),U.right=T0(e,y),U.bottom=T0(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(C)&&X.forEach((t=>{const e=C[t];S(e)||d(e)?U[Y[t][0]]=T0(e,y):$(e,t)}));else p(C)&&($({orient:C,mode:T},"x"),$({orient:C,mode:T},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?B:P,s="x"===t?R:I,n="x"===t?k:M,r=P0(G[t],t);if(A(U[Y[t][0]]))q[t]=U[Y[t][0]];else if(A(U[Y[t][1]]))q[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;q[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}q[t]*=H,N&&(q[t]+=j[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(z[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-z[t]/V,l=a/V+o-i;2!==r&&q[t]<o?L?q[t]=o:(q[t]+=0===r?n+i/2:2*n+i,q[t]>l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]<o&&(q[t]=o)))})),q}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i,s;const n=null!==(e=null===(t=this._component)||void 0===t?void 0:t.getSpec())&&void 0!==e?e:{};n.handler?null===(s=(i=n.handler).release)||void 0===s||s.call(i):(this._removeTooltip(),this._isReleased=!0,this._chartOption=null,this._component=null)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return i?{offsetX:null!==(t=i.x)&&void 0!==t?t:k0.offsetX,offsetY:null!==(e=i.y)&&void 0!==e?e:k0.offsetY}:k0}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}E0.specKey="tooltip";const O0=(t,e)=>p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",R0=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=O0(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=O0(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},I0=(t={})=>{const{lineHeight:e}=t;return t.fontSize?GI(e,t.fontSize):0},L0=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=A(l)?`${l}px`:`${l}`),r&&(o=ui(r),a.padding=O0(o)),{panelStyle:a,panelPadding:o}};function D0(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const F0=t=>{iL.registerComponentPlugin(t.type,t)};class j0 extends E0{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(j0.type),this.type=KV.dom,this._tooltipContainer=null==Kb?void 0:Kb.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Kb&&t&&t.children&&t.children.length){for(let e=0;e<t.children.length;e++)if(t.children[e].classList.contains(b0)){this._container=t.children[e];break}this._container||(this._container=Kb.createElement("div"),this._container.style.position="relative",this._container.style.zIndex=A0,this._container.classList.add(b0),t.appendChild(this._container))}}initRootDom(){var t;const e=this._component.getSpec(),i=document.createElement("div"),s=null===(t=this._chartOption)||void 0===t?void 0:t.getTheme("fontFamily");D0(i,Object.assign({left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:A0,fontFamily:null!=s?s:ZI.fontFamily,fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh",visibility:"hidden"},this._domStyle.panel)),i.classList.add(e.className),i.setAttribute("vchart-tooltip-id",`${this.id}`),this._container.appendChild(i),this._rootDom=i}_getTooltipBoxSize(t,e){var i;this._rootDom||this.initRootDom(),e||this._updateDomStringByCol(t),this._updateDomStyle("height",e);const s=null===(i=this._rootDom)||void 0===i?void 0:i.getBoundingClientRect();return{width:null==s?void 0:s.width,height:null==s?void 0:s.height}}_removeTooltip(){this._rootDom&&this._rootDom.parentNode&&(this._rootDom.parentNode.removeChild(this._rootDom),this._rootDom=null),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this._rootDom){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r);const a=this._rootDom;if(a){const{x:o=0,y:l=0}=null!==(i=r.position)&&void 0!==i?i:{};let h={x:o,y:l};const c=this.getVisibility();n.updateElement&&(this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:o,y:l}),n.updateElement(a,r,e),h=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight}),this._cacheCustomTooltipPosition=h),!c&&t&&(this._rootDom.style.transition="none",this._updatePosition(h,!1),this._rootDom.getBoundingClientRect()),this._updatePosition(h)}this.setVisibility(t)}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){const t=this._component.getSpec();this._domStyle=((t={})=>{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=L0(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),A(g)&&(y.marginBottom=`${g}px`);const _={width:O0(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=R0(h),x=R0(d),S=R0(p),k="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[k]=O0(null!==(i=c.spacing)&&void 0!==i?i:8),x[k]=O0(null!==(s=d.spacing)&&void 0!==s?s:26),S[k]=O0(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(I0(p),I0(d));return y.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(x0))),l=a.find((t=>t.className.includes(S0)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(x0),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(D0(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${_0}-column`),e.classList.add(`${_0}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(S0),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];D0(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));D0(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${_0}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=C0(e.key),e.keyStyle&&R0(e.keyStyle,l)):"value"===i?(o.innerHTML=C0(e.value),e.valueStyle&&R0(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?M0(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?M0(c):m,_=p,b=t=>new sf({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let k,A;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;A=t.toString(),k=t.bounds}else S.isSvg&&S.svgCache&&(A=S.svgCache.map((t=>t.path.toString())).join(),k=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new $e));let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=Wh.IsGradientStr(u);if(!u||y(u)&&!w||d)return m=d?"none":u?M0(u):"currentColor",`\n <svg ${l} width="${p}" height="${p}" viewBox="${M}">\n <path\n d="${A}"\n style="fill: ${m}; stroke: ${v()}; stroke-width: ${f}"\n >\n </path>\n </svg>`;const C=w?Wh.Parse(u):g(u)?u:null;if(C){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=C.stops)&&void 0!==s?s:[]).map((t=>`<stop offset="${M0(t.offset.toString())}" stop-color="${M0(t.color)}"/>`)).join("");return"radial"===C.gradient?t=`<radialGradient id="${m}" cx="50%" cy="50%" r="50%" fx="0%" fy="0%">\n ${i}\n </radialGradient>`:"linear"===C.gradient&&(t=`<linearGradient id="${m}" x1="${100*(null!==(n=C.x0)&&void 0!==n?n:0)}%" y1="${100*(null!==(r=C.y0)&&void 0!==r?r:0)}%" x2="${100*(null!==(a=C.x1)&&void 0!==a?a:0)}%" y2="${100*(null!==(o=C.y1)&&void 0!==o?o:0)}%">\n ${i}\n </linearGradient>`),`\n <svg ${l} width="${p}" height="${p}" viewBox="-0.5 -0.5 1 1">\n ${t}\n <path\n d="${A}"\n style="fill: url(#${m}); stroke: ${v()}; stroke-width: ${f}"\n >\n </path>\n </svg>`}return""}(e,`${this.id}_${a}`)),D0(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(S0))),h=[...o.children].find((t=>t.className.includes(x0)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(x0)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=GI(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,D0(l,c))}const u=l.children,g=[];if(u){for(let i=0;i<u.length;i++){const s=null!==(r=u[i].children)&&void 0!==r?r:[];for(let i=0;i<s.length;i++){e&&(s[i].style[t]="initial");const n=s[i].getBoundingClientRect()[t];(void 0===g[i]||g[i]<n)&&(g[i]=n)}}for(let e=0;e<u.length;e++){const i=null!==(a=u[e].children)&&void 0!==a?a:[];for(let e=0;e<i.length;e++)i[e].style[t]=`${g[e]}px`}}}}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle(),this._rootDom&&D0(this._rootDom,this._domStyle.panel),this.getVisibility()&&(this._updateDomStringByCol(this._tooltipActual),this._updateDomStyle("height",!1))}_updatePosition({x:t,y:e},i=!0){this._rootDom&&(this._rootDom.style.transform=`translate3d(${t}px, ${e}px, 0)`,i&&""!==this._rootDom.style.transition&&(this._rootDom.style.transition="",Object.assign(this._rootDom.style,this._domStyle.panel)))}}j0.type=KV.dom;const z0=()=>{F0(j0)},H0={fontFamily:ZI.fontFamily,spacing:10,wordBreak:"break-word"},V0=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>e<s.length-1?t+"\n":t))):s=[t],n=s.map((t=>Object.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},Kf||(Kf=$f.CreateGraphic("richtext",{})),Kf.setAttributes(a),Kf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function N0(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:H0),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const W0=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class U0 extends E0{constructor(){super(U0.type),this.type=KV.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new cI({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=ui(d.padding),b=$I(d.padding),x=N0(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=N0(Object.assign({textAlign:"right"===y?"right":"left"},f),i),k=N0(m,i),A={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},M={panel:W0(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:A,key:S,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:w={},content:C=[]}=t;let T=b.left+b.right,B=b.top+b.bottom,P=0;const E=!!C.length;let O=0,R=0,I=0,L=0;if(E){const t=[],e=[],i=[],s=[];let n=0;M.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:M}=r,w={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=eL({},S,N0(b,void 0,{})),{width:s,height:n,text:r}=V0(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=eL({},k,N0(x,void 0,{})),{width:e,height:s,text:n}=V0(m,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:A.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,a<C.length-1&&(n+=w.spaceRow),w})),B+=n,O=t.length?X(t):0,R=e.length?X(e):0,I=i.length?X(i):0,L=s.length?X(s)+A.spacing:0,P=Math.max(L+O+S.spacing+I+k.spacing,L+R,P),M.hasContentShape=!!s.length,M.keyWidth=O,M.valueWidth=I}let D=0,F=0,j=0;const{visible:z=!0,value:H="",valueStyle:V,spaceRow:N}=w;M.title.visible=z,M.title.spaceRow=null!=N?N:v;let W={};const U=()=>W.autoWidth&&!1!==W.multiLine;if(z){W=eL({},x,N0(V,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:E?Math.ceil(P):void 0);const{text:t,width:e,height:i}=V0(H,W);M.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),D=M.title.value.width,F=M.title.value.height,j=F+(E?M.title.spaceRow:0)}return B+=j,M.title.width=D,M.title.height=F,U()?T+=P||D:T+=Math.max(D,P),E&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=T-b.left-b.right-L-O-S.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=T,M.panel.height=B,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}U0.type=KV.canvas;const G0=()=>{F0(U0)},Y0=t=>{iL.registerChartPlugin(t.type,t)},$0=/\{([^}]+)\}/,X0=/\{([^}]+)\}/g,K0=/:/;class q0 extends Uz{constructor(){super(q0.type),this.type="formatterPlugin",this._timeModeFormat={utc:Ti.getInstance().timeUTCFormat,local:Ti.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Di.getInstance().format,this._numericSpecifier=Di.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[q0.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),iL.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;return this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=$0.test(i),this._isNumericFormatterCache.set(i,s))),s?i.replace(X0,((t,i)=>{if(!K0.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)})):this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ri.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}q0.pluginType="chart",q0.specKey="formatter",q0.type="formatterPlugin";const Z0={state:kF.STATE_ACTIVE,trigger:"pointerover",triggerOff:"pointerout"};class J0 extends lj{constructor(t){super(t),this.type="element-active",this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{this.reset(t.item)},this.options=Object.assign({},Z0,t),this.updateMarkIdByState([this.options.state])}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}getStartState(){return this.options.state}start(t){if(t){const{state:e,interaction:i}=this.options;this.isGraphicInStateMark(t,e)&&(t.addState(e,!0),i.setStatedGraphics(this,[t]))}}reset(t){const{interaction:e,state:i}=this.options,s=e.getStatedGraphics(this),n=null!=t?t:null==s?void 0:s[0];n&&s.includes(n)&&(n.removeState(i),e.setStatedGraphics(this,s.filter((t=>t!==n))))}}J0.type="element-active",J0.defaultOptions=Z0;const Q0="element-active-by-legend",t1={state:kF.STATE_ACTIVE,filterType:"groupKey"};class e1 extends lj{constructor(t){super(t),this.type=Q0,this.handleStart=t=>{var e,i;const s=t.event;s&&this.start(null===(i=null===(e=s.detail)||void 0===e?void 0:e.data)||void 0===i?void 0:i.id)},this.handleReset=t=>{this.resetAll()},this.options=Object.assign({},t1,t),this.updateMarkIdByState([this.options.state])}getEvents(){return[{type:yD.legendItemHover,handler:this.handleStart},{type:yD.legendItemUnHover,handler:this.handleReset}]}getStartState(){return this.options.state}start(t){if(u(t))return;const{interaction:e,state:i}=this.options,s=aj(this.options),n=e.getStatedGraphics(this),r=[];this.getMarks().forEach((e=>{var i;null===(i=e.getGraphics())||void 0===i||i.forEach((e=>{s(e)===t&&r.push(e)}))})),e.updateStates(this,r,n,i),e.setStatedGraphics(this,r)}resetAll(){const{interaction:t,state:e}=this.options;t.clearAllStatesOfTrigger(this,e),t.setStatedGraphics(this,[])}reset(t){const{state:e,interaction:i}=this.options;if(t){const s=i.getStatedGraphics(this);s&&s.includes(t)&&(t.removeState(e),i.setStatedGraphics(this,s.filter((e=>e!==t))))}else this.resetAll()}}e1.type=Q0,e1.defaultOptions=t1;const i1="element-highlight-by-group";class s1 extends lj{constructor(t){super(t),this.type=i1,this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const e=t.item;e&&this.isGraphicInMark(e)&&this.resetAll()},this.options=Object.assign({},oj,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}resetAll(){const{interaction:t,highlightState:e,blurState:i}=this.options;t.clearAllStatesOfTrigger(this,e,i),t.setStatedGraphics(this,[])}_getHightlightKey(t){var e;return null===(e=t.context)||void 0===e?void 0:e.groupKey}start(t){if(t&&this.isGraphicInMark(t)){const e=this._getHightlightKey(t);if(u(e))return;const{interaction:i,highlightState:s,blurState:n}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((t=>{var i;null===(i=t.getGraphics())||void 0===i||i.forEach((t=>{this._getHightlightKey(t)===e&&a.push(t)}))})),i.updateStates(this,a,r,s,n),i.setStatedGraphics(this,a)}}reset(t){if(t){if(this.isGraphicInMark(t)){const{interaction:e}=this.options,i=e.getStatedGraphics(this);t.removeState([this.options.highlightState,this.options.blurState]),e.setStatedGraphics(this,i.filter((e=>e!==t)))}}else this.resetAll()}}s1.type=i1,s1.defaultOptions=oj;const n1="element-highlight-by-key";class r1 extends s1{constructor(){super(...arguments),this.type=n1}_getHightlightKey(t){var e;return null===(e=t.context)||void 0===e?void 0:e.key}}r1.type=n1;const a1="element-highlight-by-legend",o1={highlightState:kF.STATE_HIGHLIGHT,blurState:kF.STATE_BLUR,filterType:"groupKey"};class l1 extends lj{constructor(t){super(t),this.type=a1,this.handleStart=t=>{var e,i;const s=t.event;s&&this.start(null===(i=null===(e=s.detail)||void 0===e?void 0:e.data)||void 0===i?void 0:i.id)},this.handleReset=t=>{this.resetAll()},this.options=Object.assign({},o1,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){return[{type:yD.legendItemHover,handler:this.handleStart},{type:yD.legendItemUnHover,handler:this.handleReset}]}start(t){if(t){const e=aj(this.options),{interaction:i,highlightState:s,blurState:n}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((i=>{var s;null===(s=i.getGraphics())||void 0===s||s.forEach((i=>{e(i)===t&&a.push(i)}))})),i.updateStates(this,a,r,s,n),i.setStatedGraphics(this,a)}}resetAll(){const{interaction:t,highlightState:e,blurState:i}=this.options;t.clearAllStatesOfTrigger(this,e,i),t.setStatedGraphics(this,[])}reset(t){const{highlightState:e,blurState:i,interaction:s}=this.options;if(t){const n=s.getStatedGraphics(this);n&&n.includes(t)&&(t.removeState([e,i]),s.setStatedGraphics(this,n.filter((e=>e!==t))))}else this.resetAll()}}l1.type=a1,l1.defaultOptions=o1;const h1="element-highlight-by-name",c1={highlightState:kF.STATE_HIGHLIGHT,blurState:kF.STATE_BLUR,filterType:"groupKey"};class d1 extends lj{constructor(t){super(t),this.type=h1,this.handleStart=t=>{if(this.options.shouldStart?this.options.shouldStart(t):this._filterByName(t)){const e=this._parseTargetKey(t);this.start(e)}},this.handleReset=t=>{(this.options.shouldReset?this.options.shouldReset(t):this._filterByName(t))&&this.resetAll()},this.options=Object.assign({},c1,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}_filterByName(t){var e;const i=Y(this.options.graphicName);return(null===(e=null==t?void 0:t.node)||void 0===e?void 0:e.name)&&i.includes(t.node.name)}_parseTargetKey(t){return this.options.parseData?this.options.parseData(t):"text"===t.node.type?t.node.attribute.text:null}start(t){if(t){const e=aj(this.options),{interaction:i,highlightState:s,blurState:n}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((i=>{var s;null===(s=i.getGraphics())||void 0===s||s.forEach((i=>{e(i)===t&&a.push(i)}))})),i.updateStates(this,a,r,s,n),i.setStatedGraphics(this,a)}}resetAll(){const{interaction:t,highlightState:e,blurState:i}=this.options;t.clearAllStatesOfTrigger(this,e,i),t.setStatedGraphics(this,[])}reset(t){const{highlightState:e,blurState:i,interaction:s}=this.options;if(t){const n=s.getStatedGraphics(this);n&&n.includes(t)&&(t.removeState([e,i]),s.setStatedGraphics(this,n.filter((e=>e!==t))))}else this.resetAll()}}d1.type=h1,d1.defaultOptions=c1;class u1 extends FF{constructor(){super(...arguments),this.type=u1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}u1.type="image";const p1=()=>{zF(),Rz(),Lz(),kW(),dU(),hN(),wN(),QN(),jU(),cX(),iL.registerMark(u1.type,u1),nw(),NM(),iL.registerGraphicComponent("image",Sf),HK(),xH()};mj.useRegisters([aN,yN,LN,XN,kq,Cq,Pq,Nq,mq,Xq,Jq,Qq,iZ,bZ,kZ,Gq,rZ,lZ,BZ,dZ,gZ,vZ,wZ,OZ,Fq,LZ,Rq,UH,XH,qH,JH,tV,oG,rG,NZ,eJ,cJ,vJ,_J,LJ,FJ,WJ,hW,PQ,jQ,o0,OQ,HQ,h0,d0,IQ,$Q,QQ,i0,p0,f0,y0,()=>{iL.registerLayout(m0.type,m0)},p1,z0,G0,()=>{Y0(q0)},()=>{iL.registerInteractionTrigger(J0.type,J0)},()=>{iL.registerInteractionTrigger(Q0,e1)},()=>{iL.registerInteractionTrigger(a1,l1)},()=>{iL.registerInteractionTrigger(h1,d1)},()=>{iL.registerInteractionTrigger(i1,s1)},()=>{iL.registerInteractionTrigger(n1,r1)},nj,Hb,()=>{__.registerPlugin("HtmlAttributePlugin",jb)}]);class g1 extends SV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","maskShape","reverse","outlineMargin","outlinePadding","indicatorSmartInvert","liquidBackground","liquidOutline"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let f1=class extends bV{constructor(){super(...arguments),this.transformerConstructor=g1,this.type="liquid",this.seriesType=MI.liquid}};f1.type="liquid",f1.seriesType=MI.liquid,f1.transformerConstructor=g1;const m1=()=>{iN(),eq(),iL.registerChart(f1.type,f1)};class v1 extends SV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","circle","overlap","overlapLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let y1=class extends bV{constructor(){super(...arguments),this.transformerConstructor=v1,this.type="venn",this.seriesType=MI.venn}};y1.type="venn",y1.seriesType=MI.venn,y1.transformerConstructor=v1;const _1=()=>{iN(),dq(),iL.registerChart(y1.type,y1)};class b1 extends kV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar","bandWidthField"])}transformSpec(t){super.transformSpec(t),ZD(t)}_setDefaultXAxisSpec(t){return{orient:"bottom",type:"linear",label:{visible:!1}}}_setDefaultYAxisSpec(t){return{orient:"left",type:"linear"}}}let x1=class extends bV{constructor(){super(...arguments),this.transformerConstructor=b1,this.type="mosaic",this.seriesType=MI.mosaic,this.handleAfterStackRegion=(t,e)=>{t.getSeries().forEach((t=>{const i=t.getStackData(),s=t.getStackValue(),n=t.getStackValueField();i&&n&&(eD(e[s],n),iD(t,e[s]))}))}}_beforeInit(){this._dataSet&&MD(this._dataSet,"stackSplit",MV)}_initStack(){this._stack=new wV(this,{afterStackRegion:this.handleAfterStackRegion}),this._stack.init()}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};x1.type="mosaic",x1.seriesType=MI.mosaic,x1.transformerConstructor=b1;const S1=()=>{tN(),iN(),nN(),EV(),PV(),pq(),iL.registerChart(x1.type,x1)};class k1 extends Uz{constructor(){super(k1.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[k1.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=nW(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom<this._maxZoom))return;n=this._maxZoom}if(n===s)return;const r=n/s;if(this._zoom=n,i.resize(i.getCurrentSize().width*this._zoom,i.getCurrentSize().height*this._zoom),e&&this._container){const{scrollLeft:t,scrollTop:i}=this._container;this._container.scrollLeft=t+e.x*(r-1),this._container.scrollTop=i+e.y*(r-1)}}release(){this._container&&this._triggerEvent&&this._container.removeEventListener(this._triggerEvent,this._onWheel)}}k1.specKey="resizeZoom",k1.type="ChartResizeZoomPlugin";function A1(t,i="ChartContainer",s){const n=e.forwardRef(((i,n)=>{const r=e.useRef(null),[a,o]=e.useState(!1),{className:l,style:h,width:c,height:d,id:u}=i,p=
|
|
9
|
+
let b$=class t extends r${constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),y=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=y*this.gridSize;const _=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,_,b);const M=u.getImageData(0,0,k,A).data;if(this.exceedTime())return null;const w=[];let C,T=S;const B=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),t<B[3]&&(B[3]=t),t>B[1]&&(B[1]=t),e<B[0]&&(B[0]=e),void(e>B[2]&&(B[2]=e))}};for(;T--;)for(C=x;C--;)P(T,C,w);return{datum:t,occupied:w,bounds:B,gw:S,gh:x,fillTextOffsetX:_,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t<this.ngx;t++)for(let i=0;i<this.ngy;i++)this.grid[t][i]&&e++;return e/t}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=g$(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=p$(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=e$(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};b$.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class x$ extends r${constructor(t){super(z({},x$.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e<i;e++)if(S$(t,this.result[e]))return!1;return!0}getTextInfo(t,e){const i={datum:t,fontSize:this.getTextFontSize(t),fontWeight:this.getTextFontWeight(t),fontStyle:this.getTextFontStyle(t),fontFamily:this.getTextFontFamily(t),angle:this.getTextRotate(t,e),text:this.getText(t)+"",x:this.center[0],y:this.center[1]},s=this.options.getTextBounds(i);return i.width=s.width(),i.height=s.height(),i.top=this.center[1]-i.height+.21*i.height,i.left=this.center[0]-i.width/2,i}layoutWord(t){const e=this.getTextInfo(this.data[t],t);let i=2*Math.PI,s=0,n=e.left,r=e.top;const a=e.width,o=e.height;let l=1,h=this.fit(e);for(;!h&&s<this.maxRadius;)s+=.5,l=this.shape(s/this.maxRadius*2*Math.PI),i+=.5*(this.options.random?this.random()>.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;i<t.length&&(this.layoutWord(i),i++,this.progressiveIndex=i,!this.exceedTime()););return this.result}}function S$(t,e){return!(t.left+t.width<e.left||t.top+t.height<e.top||t.left>e.left+e.width||t.top>e.top+e.height)}x$.defaultOptions={enlarge:!1};const k$={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},A$=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?M$(t.fontFamily):"sans-serif",d=t.fontStyle?M$(t.fontStyle):"normal",u=t.fontWeight?M$(t.fontWeight):"normal",p=t.rotate?M$(t.rotate):0,g=M$(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?M$(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",y=null!==(r=t.shrink)&&void 0!==r&&r,_=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},k$),t.as):k$,M=t.depth_3d,w=t.postProjection;let C=t.fontSize?M$(t.fontSize):14;const T=t.fontSizeRange;if(T&&!S(C)){const t=C,e=C$(T$(t,l),T);C=i=>e(t(i))}let B=o$;"fast"===t.layoutType?B=x$:"grid"===t.layoutType&&(B=b$);const P=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:C,shrink:y,clip:b,enlarge:_,minFontSize:x,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r<a;r++)n=e[r],s=n.datum,s[A.x]=n.x,s[A.y]=n.y,s[A.fontFamily]=n.fontFamily,s[A.fontSize]=n.fontSize,s[A.fontStyle]=n.fontStyle,s[A.fontWeight]=n.fontWeight,s[A.angle]=n.angle,"StereographicProjection"===w&&B$(h,n,s,A,M),t.dataIndexKey&&(s[t.dataIndexKey]=`${r}`),i.push(s);return i}}));return P.layout(l,{width:h[0],height:h[1]}),t.progressiveStep>0||t.progressiveTime>0?{progressive:P}:P.output()},M$=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],w$=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),C$=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=w$(t[0]),n=w$(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(w$(t)-r)/(a-r)*(e[1]-e[0])+e[0]},T$=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;a<n;++a)r=et(t(e[a])),r<i&&(i=r),r>s&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function B$(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l<Math.PI/2?1:-1)*Math.pow(Math.min(l-Math.PI/2,1),2)/5,{x:i*Math.sin(l)*Math.cos(o)+s.x,y:i*Math.cos(l)+s.y,z:i*Math.sin(l)*Math.sin(o)+s.z}}(t[0],t[1],r,{x:r,y:r,z:null!=n?n:r},e);i[s.x]=a.x,i[s.y]=a.y,i[s.z]=a.z}var P$;!function(t){t.BEFORE_WORDCLOUD_SHAPE_LAYOUT="beforeWordcloudShapeLayout",t.AFTER_WORDCLOUD_SHAPE_LAYOUT="afterWordcloudShapeLayout",t.AFTER_WORDCLOUD_SHAPE_DRAW="afterWordcloudShapeDraw"}(P$||(P$={}));const E$=t=>/^[\u4e00-\u9fa5]+$/.test(t),O$=(t,e)=>{if(u(t))return 0;let i=0;for(const e of t)E$(e)?i+=1:i+=.53;return i};function R$(t,e,i){const{stepFactor:s,importantWordCount:n,globalShinkLimit:r}=e,{size:a,segmentation:{regions:o},tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=l.getContext("2d",{willReadFrequently:!0}),g=j$(i);let f=g.slice(0);const m=e.fontSizeShrinkFactor;let v=null,y=1,_=1;const b=n;let x=0;t.length>b&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;e<o.length;e++){const i=o[e],{words:n,center:c,maxR:d,ratio:u}=i;let b=!1;for(let e=0;e<n.length;e++){F$(l,p,t,e);const i=n[e];if(i.x=c[0],i.y=c[1],!i.skip&&i.hasText&&i.sprite&&I$(f,i,d,u,a,h,s))i.hasPlaced=!0;else{if(!i.skip&&i.weight>x&&_>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==v&&(v=e,y=_),_*=m,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*m})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===v){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/_})),i.skip=!0,_=y,v=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i<e.textLayoutTimes;i++){const i=t.filter((t=>(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=Math.max(~~(t.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t<i.length;t++){const e=i[t];F$(l,p,i,t),e.x=c[0],e.y=c[1],e.hasText&&I$(f,e,d,u,a,h,s)&&(e.hasPlaced=!0)}}e.board=f}function I$(t,e,i,s,n,r,a){const o=e.x,l=e.y,h=function(t){return function(e){return[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}(s),c=1*a;let d,u,p,g=-c;for(;d=h(g+=c);){const{wordSize:s,bounds:{dTop:a,dBottom:h,dLeft:c,dRight:g}}=e;if(u=d[0],p=d[1],Math.min(Math.abs(u),Math.abs(p))>=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>n[0]||e.y-a<0||e.y+h>n[1]||D$(e,t,r)))return L$(e,t,r),!0}return!1}function L$(t,e,i){const{wordSize:s}=t,n=t.sprite,r=s[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t<c;t++){for(let i=0;i<r;i++)e[u+i]|=n[t*r+i];u+=a}else for(let t=0;t<c;t++){d=0;for(let i=0;i<=r;i++)e[u+i]|=d<<h|(i<r?(d=n[t*r+i])>>>l:0);u+=a}}function D$(t,e,i){const{sprite:s,wordSize:n}=t,r=i[0]>>5,a=n[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t<c;t++){for(let i=0;i<a;i++)if(e[u+i]&s[t*a+i])return!0;u+=r}else for(let t=0;t<c;t++){d=0;for(let i=0;i<=a;i++)if((d<<h|(i<a?(d=s[t*a+i])>>>l:0))&e[u+i])return!0;u+=r}return!1}function F$(t,e,i,s){if(i[s].sprite||0===i[s].fontSize)return;const n=2048,r=Math.PI/180,a=i.length;t.width=n,t.height=2048,e.clearRect(0,0,n,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=s;for(--s;++s<a;){const t=i[s],a=Math.max(t.fontSize,2);if(e.save(),e.font=t.fontStyle+" "+t.fontWeight+" "+a+"px "+t.fontFamily,o=e.measureText(t.text+"m").width+2*t.padding,l=2*a+2*t.padding,0!==t.rotate){const e=Math.sin(t.rotate*r),i=Math.cos(t.rotate*r),s=o*i,n=o*e,a=l*i,h=l*e;o=Math.max(Math.abs(s+h),Math.abs(s-h)),l=~~Math.max(Math.abs(n+a),Math.abs(n-a))}if(o=o+31>>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=n&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,n,u).data;let f,m;for(;--s>=p;){const t=i[s];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(m=0;m<r[1];m++){let t;for(f=0;f<r[0];f++)if(g[4*((c+m)*n+(h+f))+3]>0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,f<u&&(u=f),f>p&&(p=f),t|=e}t&&(m<l&&(l=m),m>d&&(d=m))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function j$(t){const{segmentation:{labels:e},boardSize:i,size:s}=t,n=i[0]>>5,r=new Array(n*s[1]).fill(0);for(let t=0;t<s[1];t++)for(let i=0;i<s[0];i++)if(0===e[t*s[0]+i]){const e=1<<31-i%32;r[n*t+(i>>5)]|=e}if(i[0]>s[0]){const t=(1<<i[0]-s[0])-1;for(let e=0;e<s[1];e++)r[n*e+n-1]|=t}return r}function z$(t,e,i){(function(t,e){const{segmentation:{regions:i}}=e;let s=-1/0,n=0,r=0;i.forEach(((t,e)=>{const i=t.area;i>s&&(s=i,r=e),n+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/n*t.length),o=i/s;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),a<t.length&&(i[r].wordsNum+=t.length-a);let o=r;const l=i.map((t=>t.regionNum));t.forEach((t=>{let e=0,s=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,s++,s>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),s=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?R$(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:s,stepFactor:n,importantWordCount:r}=e,{segmentation:{regions:a},tempCanvas:o,boardSize:l,shapeCenter:h,shapeMaxR:c,shapeRatio:d}=i,u=o.getContext("2d",{willReadFrequently:!0}),p=j$(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let v=0;t.length>m&&(v=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let y=0,_=1,b=!1;for(let r=0;r<a.length;r++){const h=a[r],{words:c,center:d,maxR:x,ratio:S}=h;let k=!1;for(let r=0;r<c.length;r++){F$(o,u,t,r);const a=c[r];if(a.x=d[0],a.y=d[1],a.hasText&&a.sprite&&I$(g,a,x,S,s,l,n)){if(a.hasPlaced=!0,a.weight>=v&&y++,y>=m&&!b){_*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),k=!0,y=0;break}}else{if(a.weight>=v&&_>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),_/=f,b=!0,g=p.slice(0),k=!0;break}if(a.weight>=v)return R$(t,e,i)}}k&&(r=-1)}for(let i=0;i<e.textLayoutTimes;i++){const i=t.filter((t=>(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=Math.max(~~(t.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t<i.length;t++){const e=i[t];F$(o,u,i,t),e.x=h[0],e.y=h[1],e.hasText&&I$(g,e,c,d,s,l,n)&&(e.hasPlaced=!0)}}e.board=g}(t,e,i):function(t,e,i){const{size:s,stepFactor:n}=e,{segmentation:{regions:r},tempCanvas:a,boardSize:o,shapeCenter:l,shapeMaxR:h,shapeRatio:c}=i,d=j$(i),u=a.getContext("2d",{willReadFrequently:!0});for(const e of r){const{words:i,center:r,maxR:l,ratio:h}=e;for(let e=0;e<i.length;e++){F$(a,u,t,e);const c=i[e];c.x=r[0],c.y=r[1],c.hasText&&c.sprite&&I$(d,c,l,h,s,o,n)&&(c.hasPlaced=!0)}}for(let i=0;i<e.textLayoutTimes;i++){const i=t.filter((t=>(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=Math.max(~~(t.fontSize*e.fontSizeShrinkFactor),e.minFontSize)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t<i.length;t++){const e=i[t];F$(a,u,i,t),e.x=l[0],e.y=l[1],e.hasText&&I$(d,e,h,c,s,o,n)&&(e.hasPlaced=!0)}}e.board=d}(t,e,i);const s=function(t,e,i){const{size:s,fillingTimes:n,fillingXStep:r,fillingYStep:a,getFillingFontStyle:o,getFillingFontWeight:l,getFillingFontFamily:h,fillingInitialFontSize:c,fillingDeltaFontSize:d,fillingInitialOpacity:u,fillingDeltaOpacity:p,fillingRotateList:g,getFillingPadding:f,random:m,board:v,minFillFontSize:y}=e,{boardSize:_,shapeBounds:b,tempCanvas:x,randomGenerator:S}=i,k=x.getContext("2d",{willReadFrequently:!0});let A=c,M=u;const w=[];for(let t=0;t<n;t++)C(A,M),A=Math.max(A>d?A-d:d,y),M=M>p?M-p:p;return w;function C(e,i){const n=t.map((t=>{const{text:s,color:n,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:s,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:n,fillingColor:r,hasPlaced:a,datum:c}}));T(n);let c=0;const{x1:d,y1:u,x2:p,y2:y}=b,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=y;t+=a)for(let e=A;e<=p;e+=r){F$(x,k,n,c);const i=n[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===n.length&&(c=0,m&&T(n));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>s[0]||i.y-l<0||i.y+h>s[1]||i.hasText&&i.sprite&&!D$(i,v,_)&&(L$(i,v,_),w.push(Object.assign({},i)),++c===n.length&&(c=0,m&&T(n)))}}function T(t){return t.sort((()=>S()-.5))}}(t,e,i),n=[],r=[];for(let e=0;e<t.length;e++)t[e].hasPlaced?r.push(t[e]):n.push(t[e]);return n.forEach((t=>t.visible=!1)),{fillingWords:s,successedWords:r,failedWords:n}}const H$={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"};class V${constructor(t){this.progressiveResult=[],this.options=t}layout(t){this.data=t;const e=this.options,i={shapeUrl:e.shape,size:e.size,ratio:e.ratio||.8,tempCanvas:void 0,boardSize:[0,0],random:!1,randomGenerator:void 0},s=this.options.createCanvas({width:e.size[0],height:e.size[1]}),n=s.getContext("2d",{willReadFrequently:!0});n.textAlign="center",n.textBaseline="middle",i.tempCanvas=s;const r=e.size[0]+31>>5<<5;if(i.boardSize=[r,e.size[1]],i.random?i.randomGenerator=Math.random:i.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})(),this.segmentationInput=i,y(i.shapeUrl)){i.isEmptyPixel=p$(void 0,void 0,this.options.createCanvas);const t=function(t,e){return t&&(M(t)||w(t)||t.startsWith("<svg"))?new Promise(((i,s)=>{var n;const r=e({image:t}),a=null===(n=r.resources)||void 0===n?void 0:n.get(t);a&&"success"===a.state&&a.data?i(a.data):(r.successCallback=()=>{var e;if(r){const n=null===(e=r.resources)||void 0===e?void 0:e.get(t);n&&"success"===n.state&&n.data?i(n.data):s(new Error("image load failed: "+t))}else s(new Error("image load failed: "+t))},r.failCallback=()=>{s(new Error("image load failed: "+t))})})):null}(i.shapeUrl,this.options.createImage);t?(this.isImageFinished=!1,this.isLayoutFinished=!1,t.then((t=>{this.isImageFinished=!0;const s=this.options.createCanvas({width:e.size[0],height:e.size[1],dpr:1});i.maskCanvas=s;const n=s.getContext("2d");e.removeWhiteBorder&&function(t,e,i){e.width=t.width,e.height=t.height;const s=e.getContext("2d",{willReadFrequently:!0});s.clearRect(0,0,e.width,e.height),s.drawImage(t,0,0);const n=e.width,r=s.getImageData(0,0,e.width,e.height);let a=0,o=r.height,l=0,h=r.width;const c=(t,e)=>{for(let s=0;s<t;++s)if(!i(r,e,s))return!1;return!0},d=(t,e,s)=>{for(let n=e;n<s;++n)if(!i(r,n,t))return!1;return!0};for(;a<o&&c(n,a);)++a;for(;o-1>a&&c(n,o-1);)--o;for(;l<h&&d(l,a,o);)++l;for(;h-1>l&&d(h-1,a,o);)--h;const u=s.getImageData(l,a,h-l,o-a);e.width=u.width,e.height=u.height,s.clearRect(0,0,e.width,e.height),s.putImageData(u,0,0)}(t,s,i.isEmptyPixel);const r=function(t,e){const i=t.width,s=t.height;let n=e[0]/i;s*n>e[1]&&(n=e[1]/s);const r=Math.floor(n*i),a=Math.floor(n*s);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:n}}(t,e.size);n.clearRect(0,0,e.size[0],e.size[1]),n.drawImage(t,r.x,r.y,r.width,r.height),this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i.maskCanvas)})).catch((t=>{this.isImageFinished=!0}))):(this.isImageFinished=!0,this.isLayoutFinished=!0)}else if(i.shapeUrl&&("text"===i.shapeUrl.type||"geometric"===i.shapeUrl.type)){i.isEmptyPixel=p$(i.shapeUrl.backgroundColor,void 0,this.options.createCanvas);const t=g$(i.shapeUrl,e.size[0],e.size[1],void 0,!1,this.options.createCanvas);i.maskCanvas=t,this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(t),this.doLayout(),this.isImageFinished=!0,this.isLayoutFinished=!0}}canAnimate(){return!0}unfinished(){return!this.isLayoutFinished}output(){return this.progressiveResult}progressiveRun(){this.isImageFinished&&!this.isLayoutFinished&&(this.segmentationInput.maskCanvas&&this.doLayout(),this.isLayoutFinished=!0)}progressiveOutput(){return this.progressiveResult}doLayout(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b;const x=this.segmentationInput,S=_$(x);if(!S.segmentation.regions.length)return;const k=this.options,A=this.data,M=k.colorMode||"ordinal",w={getText:Et(k.text),getFontSize:Et(k.fontSize),fontSizeRange:k.fontSizeRange,colorMode:M,getColor:k.colorField?Et(k.colorField):Et(k.text),getFillingColor:Et(k.fillingColorField),colorList:k.colorList||("ordinal"===M?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:Et(k.colorHexField),getFontFamily:Et(k.fontFamily||"sans-serif"),rotateList:k.rotateList||[0],getPadding:Et(k.padding||1),getFontStyle:Et(k.fontStyle||"normal"),getFontWeight:Et(k.fontWeight||"normal"),getFontOpacity:k.fontOpacity?Et(k.fontOpacity):()=>1};W$(A,w,S);const C={size:k.size,ratio:k.ratio||.8,shapeUrl:k.shape,random:void 0===k.random||k.random,textLayoutTimes:null!==(t=k.textLayoutTimes)&&void 0!==t?t:3,removeWhiteBorder:k.removeWhiteBorder,layoutMode:null!==(e=k.layoutMode)&&void 0!==e?e:"default",fontSizeShrinkFactor:null!==(i=k.fontSizeShrinkFactor)&&void 0!==i?i:.8,stepFactor:null!==(s=k.stepFactor)&&void 0!==s?s:1,importantWordCount:null!==(n=k.importantWordCount)&&void 0!==n?n:10,globalShinkLimit:k.globalShinkLimit||.2,fontSizeEnlargeFactor:null!==(r=k.fontSizeEnlargeFactor)&&void 0!==r?r:1.5,fillingRatio:null!==(a=k.fillingRatio)&&void 0!==a?a:.7,fillingTimes:null!==(o=k.fillingTimes)&&void 0!==o?o:4,fillingXStep:k.fillingXRatioStep?Math.max(Math.floor(k.size[0]*k.fillingXRatioStep),1):null!==(l=k.fillingXStep)&&void 0!==l?l:4,fillingYStep:k.fillingYRatioStep?Math.max(Math.floor(k.size[1]*k.fillingYRatioStep),1):null!==(h=k.fillingYStep)&&void 0!==h?h:4,fillingInitialFontSize:k.fillingInitialFontSize,fillingDeltaFontSize:k.fillingDeltaFontSize,fillingInitialOpacity:null!==(c=k.fillingInitialOpacity)&&void 0!==c?c:.8,fillingDeltaOpacity:null!==(d=k.fillingDeltaOpacity)&&void 0!==d?d:.05,getFillingFontFamily:Et(k.fillingFontFamily||"sans-serif"),getFillingFontStyle:Et(k.fillingFontStyle||"normal"),getFillingFontWeight:Et(k.fillingFontWeight||"normal"),getFillingPadding:Et(null!==(u=k.fillingPadding)&&void 0!==u?u:.4),fillingRotateList:null!==(p=k.fillingRotateList)&&void 0!==p?p:[0,90],fillingDeltaFontSizeFactor:null!==(g=k.fillingDeltaFontSizeFactor)&&void 0!==g?g:.2,fillingColorList:k.fillingColorList||["#537EF5"],sameColorList:!1,minInitFontSize:null!==(f=k.minInitFontSize)&&void 0!==f?f:10,minFontSize:null!==(m=k.minFontSize)&&void 0!==m?m:4,minFillFontSize:null!==(v=k.minFillFontSize)&&void 0!==v?v:2},T=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0})(w.colorList,C.fillingColorList);C.sameColorList=T,N$(A,w,C,k),function(t,e,i,s){const{getText:n}=e;let{fillingInitialFontSize:r,fillingDeltaFontSize:a}=i;const{fillingRatio:o}=i,l=Math.ceil(Math.sqrt(s.shapeArea)/4);if(!r||!a){const e=o/100,h=t.reduce(((t,e)=>{const i=O$(n(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*s.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(A,w,C,S);const{getText:B,getFontFamily:P,getFontStyle:E,getFontWeight:O,getPadding:R,getColor:I,getFillingColor:L,getColorHex:D,fontSizeScale:F,colorScale:j,fillingColorScale:z,getFontOpacity:H,rotateList:V}=w,N=A.map((t=>{var e,i;return{x:0,y:0,weight:0,text:B(t),fontFamily:P(t),fontWeight:O(t),fontStyle:E(t),rotate:V[~~(x.randomGenerator()*V.length)],fontSize:Math.max(C.minInitFontSize,~~F(t)),opacity:H(t),padding:R(t),color:D&&D(t)||j&&j(I(t))||"black",fillingColor:!L||(null===(e=k.colorField)||void 0===e?void 0:e.field)===(null===(i=k.fillingColorField)||void 0===i?void 0:i.field)&&T?void 0:D&&D(t)||z&&z(L(t))||"black",datum:t,visible:!0,hasPlaced:!1}})),W=X(N.map((t=>t.fontSize)));N.forEach((t=>t.weight=t.fontSize/W)),N.sort(((t,e)=>e.weight-t.weight));const{fillingWords:U,successedWords:G,failedWords:Y}=z$(N,C,S),$=null!==(_=null===(y=k.text)||void 0===y?void 0:y.field)&&void 0!==_?_:"textKey",K=null!==(b=k.dataIndexKey)&&void 0!==b?b:"defaultDataIndexKey",q=k.as?Object.assign(Object.assign({},H$),k.as):H$;let Z,J;const Q=[];for(let t=0;t<N.length;++t)Z=N[t],J=Z.datum,J[q.x]=Z.x,J[q.y]=Z.y,J[q.fontFamily]=Z.fontFamily,J[q.fontSize]=Z.fontSize,J[q.fontStyle]=Z.fontStyle,J[q.fontWeight]=Z.fontWeight,J[q.angle]=oe(Z.rotate),J[q.opacity]=Z.opacity,J[q.visible]=Z.visible,J[q.isFillingWord]=!1,J[q.color]=Z.color,J[K]=`${Z.text}_${t}_keyword`,Q.push(J);const tt=[];U.forEach(((t,e)=>{var i,s;const n=Object.assign({},t.datum);n[q.x]=t.x,n[q.y]=t.y,n[q.fontFamily]=t.fontFamily,n[q.fontSize]=t.fontSize,n[q.fontStyle]=t.fontStyle,n[q.fontWeight]=t.fontWeight,n[q.angle]=oe(t.rotate),n[q.opacity]=t.opacity,n[q.visible]=t.visible,n[q.isFillingWord]=!0,n[q.color]=L?(null===(i=k.colorField)||void 0===i?void 0:i.field)===(null===(s=k.fillingColorField)||void 0===s?void 0:s.field)&&T?t.color:t.fillingColor:C.fillingColorList[~~(x.randomGenerator()*C.fillingColorList.length)],n[$]=t.text,n[K]=`${t.text}_${e}_fillingWords`,tt.push(n)})),this.options.onLayoutFinished&&this.options.onLayoutFinished({successedWords:G,failedWords:Y}),this.progressiveResult=Q.concat(tt)}release(){this.segmentationInput=null,this.data=null,this.progressiveResult=null,this.options=null}}const N$=(t,e,i,s)=>{var n,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new BP).domain(e).range(g).scale(t),c&&((null===(n=s.colorField)||void 0===n?void 0:n.field)!==(null===(r=s.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new BP).domain(e).range(f).scale(t)}}else{1===g.length&&(g=[g[0],g[0]]);const e=(new QP).domain(G$(h,t)).range(g);if(u=t=>e.scale(t),c&&((null===(a=s.colorField)||void 0===a?void 0:a.field)!==(null===(o=s.fillingColorField)||void 0===o?void 0:o.field)||!d)){1===f.length&&(f=[f[0],f[0]]);const e=(new QP).domain(G$(c,t)).range(f);p=t=>e.scale(t)}}Object.assign(e,{colorScale:u,fillingColorScale:p})},W$=(t,e,i)=>{let{fontSizeRange:s}=e;const{getFontSize:n,getText:r}=e;let a;if(n){if(n&&s){const e=(new nE).domain(G$(n,t)).range(s);a=t=>e.scale(n(t))}else if(n&&d(n)&&!s){const e=.5,[o,l]=G$(n,t),h=t.map((t=>({text:r(t),value:n(t),weight:l===o?1:(n(t)-o)/(l-o)}))),c=U$(h,i,!0);s=[~~(e*c),~~c];const d=(new nE).domain(G$(n,t)).range(s);a=t=>d.scale(n(t))}}else{const e=t.map((t=>({text:r(t)}))),s=U$(e,i,!1);a="function"==typeof(o=s)?o:function(){return o}}var o;Object.assign(e,{getFontSize:n,fontSizeRange:s,fontSizeScale:a})},U$=(t,e,i)=>{const s=e.shapeArea,n=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(s)/12),o=t.reduce(((t,e)=>{const s=O$(e.text);return s<a?t+s*(i?(.5+.5*e.weight)**2:1):t}),0);if(0===o)return 12;let l=20;if(1===r.length)l=Math.sqrt(n*(s/(1.7*o)));else{const t=[];for(let e=0;e<r.length;e++){const i=r[e].area,a=r[e].ratio,l=i/s;if(l<.1)continue;const h=l*(o*(a<1?2.7-a:1.7)),c=Math.sqrt(n*(i/h));t.push(c)}l=t.length?Math.min(...t):Math.sqrt(n*(s/(1.7*o)))}return l};const G$=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;a<n;++a)r=et(t(e[a])),r<i&&(i=r),r>s&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]},Y$=(t,e,i)=>{if(!t.size||u(t.size[0])||u(t.size[1])||t.size[0]<=0||t.size[1]<=0)return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];if(t.size=[Math.ceil(t.size[0]),Math.ceil(t.size[1])],t.shape||at.getInstance().error("WordcloudShape shape must be specified."),t.text||at.getInstance().error("WordcloudShape text must be specified."),t.onBeforeLayout&&t.onBeforeLayout(),!e||0===e.length)return[];const s=new V$(t);return s.layout(e),s.unfinished()?{progressive:s}:s.output()};class $$ extends QG{constructor(){super(...arguments),this.type=MI.wordCloud}}$$.type=MI.wordCloud;const X$=()=>{iL.registerGrammarTransform("wordcloud",{transform:A$}),dU(),eY(),iL.registerSeries($$.type,$$)},K$=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:f=!1,isCone:m=!0,range:v}=e,y=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),_=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:_,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:y];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),y=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),_=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=A(_*v)&&0!==v?_/v:0,S=A(v*y)&&0!==y?v/y:0;u&&(t[u]=y),g&&(t[g]=_),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:_/b[1]),d&&(t[d]=0===e?1:y/b[1]),p&&(t[p]=v)})),n},q$=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},Z$=`${kL}_FUNNEL_TRANSFORM_RATIO`,J$=`${kL}_FUNNEL_REACH_RATIO`,Q$=`${kL}_FUNNEL_HEIGHT_RATIO`,tX=`${kL}_FUNNEL_VALUE_RATIO`,eX=`${kL}_FUNNEL_LAST_VALUE_RATIO`,iX=`${kL}_FUNNEL_NEXT_VALUE_RATIO`,sX=`${kL}_FUNNEL_LAST_VALUE`,nX=`${kL}_FUNNEL_CURRENT_VALUE`,rX=`${kL}_FUNNEL_NEXT_VALUE`,aX=`${kL}_FUNNEL_TRANSFORM_LEVEL`;class oX extends Ej{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?`${(100*(null==t?void 0:t[J$])).toFixed(1)}%`:this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class lX extends FF{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class hX extends lX{constructor(){super(...arguments),this.type=hX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}hX.type="polygon";const cX=()=>{iL.registerMark(hX.type,hX),nw(),XM(),sj(),iL.registerGraphicComponent("polygon",Nf)},dX=Object.assign(Object.assign({},Wj),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class uX extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class pX extends az{constructor(){super(...arguments),this.type=MI.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=uX,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;MD(this._dataSet,"funnel",K$),MD(this._dataSet,"funnelTransform",q$);const t=new so(this._dataSet,{name:`${kL}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new EF(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:nX,asTransformRatio:Z$,asReachRatio:J$,asHeightRatio:Q$,asValueRatio:tX,asNextValueRatio:iX,asLastValueRatio:eX,asLastValue:sX,asNextValue:rX,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:aX}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},pX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:ez(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},pX.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(pX.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(pX.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new oX(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",sF.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",sF.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",sF.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",sF.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",sF.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;p(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===this._funnelMark){this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",sF.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Wb(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&Wb(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*kI(J$).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",sF.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(Zj(null===(s=iL.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),Jj("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(Zj(iL.getAnimationInKey("fadeInOut")(),Jj(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(Zj(iL.getAnimationInKey("funnel")({},o),Jj(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(Zj(null===(a=iL.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),Jj("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[eX])/2:this._getSecondaryAxisLength(t[tX])/2,n=this._getSecondaryAxisLength(t[tX])/2):(s=this._getSecondaryAxisLength(t[tX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[iX])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[aX])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[CL]===t[CL]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_<this._minLabelLineWidth&&(_=y-this._minLabelLineWidth),v=m):(y=this._getPolygonCenter(i).y+s/2+e,_=!1!==f.alignLabel?(null==u?void 0:u.y1)-e:y+e,m=this._getPolygonCenter(i).x,_-y<this._minLabelLineWidth&&(_=y+this._minLabelLineWidth),v=m),{x1:m,x2:v,y1:y,y2:_}}const b=this.getPoints(t),x=(Math.abs(b[0].x-b[1].x)+Math.abs(b[2].x-b[3].x))/2,S=(null==g?void 0:g.x2)-(null==g?void 0:g.x1)||0,k=null!==(c=f.spaceWidth)&&void 0!==c?c:5;return"right"===this._spec.outerLabel.position||"left"===this._funnelAlign?(m=this._getPolygonCenter(b).x+Math.max(S/2,x/2)+k,v=!1!==f.alignLabel?(null==u?void 0:u.x1)-k:m+k,y=this._getPolygonCenter(b).y,v-m<this._minLabelLineWidth&&(v=m+this._minLabelLineWidth),_=y):(m=this._getPolygonCenter(b).x-Math.max(S/2,x/2)-k,v=!1!==f.alignLabel?(null==u?void 0:u.x2)+k:m-k,y=this._getPolygonCenter(b).y,m-v<this._minLabelLineWidth&&(v=m-this._minLabelLineWidth),_=y),{x1:m,x2:v,y1:y,y2:_}}_computeMaxSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width;return GI(null!==(t=this._spec.maxSize)&&void 0!==t?t:"80%",e)}_computeMinSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width;return GI(null!==(t=this._spec.minSize)&&void 0!==t?t:0,e)}_isHorizontal(){return"left"===this._funnelOrient||"right"===this._funnelOrient}_isReverse(){return"bottom"===this._funnelOrient||"right"===this._funnelOrient}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._funnelMark]}}pX.type=MI.funnel,pX.mark=dX,pX.builtInTheme={funnel:aL},pX.transformerConstructor=uX;const gX=()=>{cX(),dU(),kW(),iL.registerSeries(pX.type,pX),iL.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},KF))),iL.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:JT,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),ZF()},fX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},mX=t=>{const e=t.filter((t=>t.context.diffState===SF.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},vX=(t,e,i)=>E(t)?[e,i]:[K(t.map((t=>1*t.getFinalAttribute().startAngle))),X(t.map((t=>1*t.getFinalAttribute().endAngle)))],yX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=mX(i.parent.children),a=vX(r,s,n);return fX(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=mX(i.parent.children),a=vX(r,s,n);return fX(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),_X=t=>[K(t.map((t=>1*t.getFinalAttribute().startAngle))),X(t.map((t=>1*t.getFinalAttribute().endAngle)))],bX=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=mX(i.parent.children),a=_X(r);return fX(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=mX(i.parent.children),a=_X(r);return fX(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),xX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},SX=(t,e={})=>{if(!t)return[];const i=[];return rY(t,i,e),i},kX=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new RY(i).layout(t,{width:s,height:n})};class AX extends Ej{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var MX;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(MX||(MX={}));const wX=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===MX.DrillDown){return Y(aD(t,n,s,"children"))}if(i.type===MX.DrillUp){const e=oD(t,n,s,"children");if(e)return Y(e)}return t};class CX{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=nW(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;MD(t,"drillFilter",wX),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!_(t)||E(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:MX.DrillDown},e().reRunAllTransform(),i.emit(yD.drill,{value:{path:t,type:MX.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!_(n)||E(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:MX.DrillUp},i().reRunAllTransform(),s.emit(yD.drill,{value:{path:n,type:MX.DrillUp},model:this}),n}}const TX=Object.assign(Object.assign({},Wj),{sunburst:{name:"sunburst",type:"arc"}}),BX=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:Dj,operations:["max","min","values"]}),t.push({key:Fj,operations:["values"]}),t),PX={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class EX extends MU{constructor(){super(...arguments),this.type=MI.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:Fj),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:CL},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),MD(this._dataSet,"sunburstLayout",kX),MD(this._dataSet,"flatten",SX),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return BX(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(MD(t.dataSet,"addVChartProperty",kj),t.transform({type:"addVChartProperty",options:{beforeCall:Vj.bind(this),call:Nj}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(EX.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},kF.STATE_NORMAL,sF.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(EX.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},kF.STATE_NORMAL,sF.Series)}initTooltip(){this._tooltipHelper=new AX(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),Jj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),Jj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}EX.type=MI.sunburst,EX.mark=TX,EX.builtInTheme={sunburst:PX},G(EX,CX);const OX=()=>{iL.registerSeries(EX.type,EX),jU(),dU(),ZF(),iL.registerAnimation("sunburst",((t,e)=>({appear:xX(0,e),enter:yX(t),exit:bX(t),disappear:{duration:$F.disappear.duration}})))},RX=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return 0===s||0===n?t:new xY(i).layout(t,{width:s,height:n})};class IX extends Ej{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const LX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},DX=Object.assign(Object.assign({},Wj),{circlePacking:{name:"circlePacking",type:"arc"}});class FX extends hz{constructor(){super(...arguments),this.type=MI.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:Fj),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:CL},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),MD(this._dataSet,"circlePackingLayout",RX),MD(this._dataSet,"flatten",SX),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(MD(t.dataSet,"addVChartProperty",kj),t.transform({type:"addVChartProperty",options:{beforeCall:Vj.bind(this),call:Nj}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(FX.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},kF.STATE_NORMAL,sF.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(FX.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},kF.STATE_NORMAL,sF.Series)}getStatisticFields(){return BX(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new IX(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(Zj(null===(i=iL.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),Jj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),Jj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}FX.type=MI.circlePacking,FX.mark=DX,FX.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(FX,CX);const jX=()=>{iL.registerSeries(FX.type,FX),jU(),dU(),qF(),iL.registerAnimation("circlePacking",((t,e)=>({appear:LX(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:$F.disappear.duration}})))},zX=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&zX(t,e.children,i)}))},HX=t=>{var e;if(!t||!_(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},VX=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new PY(e),r=[];return r.push(n.layout(s,i)),r},NX=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},WX=t=>{var e,i;return t&&_(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class UX extends Ej{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const GX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:((t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}))(t),YX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class $X extends BT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class XX extends BT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const KX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},qX=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class ZX extends YW{constructor(){super(...arguments),this.type=ZX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?qX:KX,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}ZX.type="linkPath";const JX=Object.assign(Object.assign({},Wj),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class QX extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const tK=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class eK extends hz{constructor(){super(...arguments),this.type=MI.sankey,this.transformerConstructor=QX,this._nodeLayoutZIndex=eF.Node,this._labelLayoutZIndex=eF.Label,this._viewBox=new $e,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{t.removeState(kF.STATE_SANKEY_EMPHASIS),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE)})),s.forEach((t=>{t.removeState(kF.STATE_SANKEY_EMPHASIS),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=pD(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=pD(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(kF.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(kF.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(kF.STATE_SANKEY_EMPHASIS),t.addState(kF.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=pD(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),tK(e,kF.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(kF.STATE_SANKEY_EMPHASIS),e.addState(kF.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=pD(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=pD(n[0]))||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=pD(n),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=pD(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(kF.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(kF.STATE_SANKEY_EMPHASIS),t.addState(kF.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;r<n;r++){const n=s[r].key,a=s[r+1]?s[r+1].key:i.key,o=e.value,l=t.find((t=>t.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=pD(s),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0)/a.value;return s.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),void tK(s,kF.STATE_SANKEY_EMPHASIS,{ratio:e})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),void tK(s,kF.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState(kF.STATE_SANKEY_EMPHASIS),s.addState(kF.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(i&&i.length){if("source"==(pD(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{t.removeState(kF.STATE_SANKEY_EMPHASIS),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&e.forEach((t=>{t.removeState(kF.STATE_SANKEY_EMPHASIS),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const s=pD(t),n=[s.source,s.target],r=[];Y(s.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;s<i-1;s++){const i=e[s].key,n=e[s+1].key,a=t.value,o=r.find((t=>t.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),i.forEach((t=>{const e=pD(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),void tK(t,kF.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0)/e.value;return t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),void tK(t,kF.STATE_SANKEY_EMPHASIS,{ratio:i})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),t.removeState(kF.STATE_SANKEY_EMPHASIS_REVERSE),void tK(t,kF.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});t.removeState(kF.STATE_SANKEY_EMPHASIS),t.addState(kF.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,n)}this._needClear=!0}}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){MD(this._dataSet,"sankeyLayout",VX),MD(this._dataSet,"sankeyFormat",HX),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:FD.sankeyLayout});const{dataSet:a}=this._option;MD(a,"sankeyNodes",NX),MD(a,"flatten",SX);const o=new so(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:zj.bind(this),call:Hj}},!1),this._nodesSeriesData=o,MD(a,"sankeyLinks",WX);const l=new so(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:zj.bind(this),call:Hj}},!1),this._linksSeriesData=l}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(eK.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(eK.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},kF.STATE_NORMAL,sF.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",sF.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},kF.STATE_NORMAL,sF.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",sF.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=bj(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(Zj(null===(i=iL.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),Jj("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(Zj(null===(s=iL.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),Jj("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:bD.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([kF.STATE_SANKEY_EMPHASIS_REVERSE,kF.STATE_SANKEY_EMPHASIS]),e.includes(pD(t).key)?t.addState(kF.STATE_SANKEY_EMPHASIS,!0):t.addState(kF.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new UX(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new FI;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{i.add(t[e]),t.children&&this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;return this._rawStatisticsCache||(this._rawStatisticsCache={}),this._rawStatisticsCache[t]||(this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})),this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return zX(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}eK.type=MI.sankey,eK.transformerConstructor=QX,eK.mark=JX,eK.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const iK=()=>{wN(),$W(),YM(),iL.registerGraphicComponent("path",(t=>Ef(t))),iL.registerMark(ZX.type,ZX),dU(),iL.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:GX(t,e)},KF))),iL.registerAnimation("sankeyLinkPath",((t,e)=>({appear:YX(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:$F.disappear.duration}}))),yT.registerBuiltInAnimate("linkPathGrowOut",XX),yT.registerBuiltInAnimate("linkPathGrowIn",$X),ZF(),iL.registerSeries(eK.type,eK)},sK=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=SX(n);return i=Rj([{latestData:r}],e),i};class nK extends Ej{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const rK=Object.assign(Object.assign({},Wj),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),aK=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class oK extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const lK=(t,e)=>{if(e.getViewBox()){const i=new FY(e).layout(t,e.getViewBox()),s=[];return rY(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[Fj,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class hK extends hz{constructor(){super(...arguments),this.type=MI.treemap,this.transformerConstructor=oK,this._categoryField="name",this._valueField="value",this._viewBox=new $e,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:Fj),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new qe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:CL},getRawData:()=>this.getRawData()}),A(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),MD(this._dataSet,"treemap",lK),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(MD(this._rawData.dataSet,"addVChartProperty",kj),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Vj.bind(this),call:Nj}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=sK([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){MD(this._dataSet,"hierarchyDimensionStatistics",sK),MD(this._dataSet,"flatten",SX);const i=new so(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return BX(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(hK.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(hK.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},kF.STATE_NORMAL,sF.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},kF.STATE_NORMAL,sF.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},kF.STATE_NORMAL,sF.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},kF.STATE_NORMAL,sF.Series),this._initRichStyleOfLabelMark(t))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},kF.STATE_NORMAL,sF.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("treemap"))||void 0===e?void 0:e(),Jj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new nK(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(mD.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(mD.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}hK.type=MI.treemap,hK.mark=rK,hK.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},hK.transformerConstructor=oK,G(hK,CX),G(hK,aW);const cK=()=>{iL.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),iL.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),wN(),dU(),iL.registerAnimation("treemap",((t,e)=>({appear:aK(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:$F.disappear.duration}}))),ZF(),iL.registerSeries(hK.type,hK)},dK=Object.assign(Object.assign({},PG),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),uK=Object.assign(Object.assign({},Wj),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),pK={type:"fadeIn"};function gK(t,e){return"fadeIn"===e?pK:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class fK extends rz{constructor(){super(...arguments),this._supportStack=!1}}class mK extends Ej{enableByType(t){return"dimension"!==t}}const vK="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",yK={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:vK,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:vK,fill:"#ddd"}}};class _K extends EG{constructor(){super(...arguments),this.type=MI.gaugePointer,this.transformerConstructor=fK,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(_K.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},_K.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(_K.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new mK(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=K(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(Zj(null===(i=iL.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Jj("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}_K.type=MI.gaugePointer,_K.mark=uK,_K.builtInTheme={gaugePointer:yK},_K.transformerConstructor=fK;const bK=()=>{iL.registerSeries(_K.type,_K),QN(),wN(),iL.registerAnimation("gaugePointer",((t,e)=>{const i=gK(t,e);return{appear:i,enter:i,disappear:{duration:$F.disappear.duration}}})),oG(),rG()};class xK extends rz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class SK extends EG{constructor(){super(...arguments),this.type=MI.gauge,this.transformerConstructor=xK,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData(),MD(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[YL]=t[this._angleField[0]],t[GL]=e>0?i[e-1][YL]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(SK.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(SK.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,sF.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?HI(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?HI(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[GL])?this.angleAxisHelper.dataToPosition([t[GL]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[YL]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(Zj(null===(i=iL.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Jj("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}SK.type=MI.gauge,SK.mark=dK,SK.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},SK.transformerConstructor=xK;const kK=()=>{iL.registerSeries(SK.type,SK),jU(),LG(),rG()};class AK extends FF{constructor(){super(...arguments),this.type=AK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return nf(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}AK.type="cell";function MK(t){return!1===t?{}:{type:"fadeIn"}}class wK extends Ej{enableByType(t){return"dimension"!==t}}const CK=Object.assign(Object.assign({},Wj),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class TK extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class BK extends hz{constructor(){super(...arguments),this.type=MI.heatmap,this.transformerConstructor=TK}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(BK.mark.cell,{isSeriesMark:!0},{morph:ez(this._spec,BK.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(BK.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",sF.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=ui(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",sF.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=lz(this);this._cellMark.setAnimationConfig(Zj(null===(i=iL.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),Jj("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new wK(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}BK.type=MI.heatmap,BK.mark=CK,BK.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1}}},BK.transformerConstructor=TK;const PK=()=>{dU(),iL.registerMark(AK.type,AK),iL.registerGraphicComponent("symbol",nf),nw(),aw(),XE(),iL.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},KF),{appear:MK(e)}))),XH(),UH(),iL.registerSeries(BK.type,BK)},EK=Object.assign(Object.assign({},Wj),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),OK=`${kL}_CORRELATION_X`,RK=`${kL}_CORRELATION_Y`,IK=`${kL}_CORRELATION_SIZE`,LK=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const b=oe(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=oe(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),A=Ot(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Ot(e.outerRadius,k),w=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+Ot(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+Ot(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],C=Pt(e.field),T=t.map(C),[B,P]=It(T),E=B===P?t=>(A+M)/2:t=>A+(M-A)*(t-B)/(P-B),O=u(e.radiusField)?C:Pt(e.radiusField),R=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let I=t=>R;if(O){const[i,s]=O!==C?It(t.map(O)):[B,P],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(O(t)-i)/(s-i))}const L=Math.min(b,x),D=Math.max(b,x),F=DK(L,D,t.length),j=[],z=(D-L)/60;return t.forEach(((t,e)=>{const i=E(T[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),FK({x:n,y:r,size:s},j)||n-s<y.x0||n+s>y.x1||r-s<y.y0||r+s>y.y1);t++)t<59&&(a+=z,a>D?a=L:a<L&&(a=D));j.push(Object.assign({[OK]:n,[RK]:r,[IK]:s},t))})),j},DK=(t,e,i)=>{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l<i;)h<n&&(c.push(d+(h%2?Math.floor(h/2)+Math.floor(n/2):h/2)*r*o),h++),l++,h===n&&(h=0,a+=1,o*=-1,0===s?s=r/2:s/=2,d=-1===o?e-s:t+s,a>=2&&(r/=2,n*=2));return c},FK=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<Math.pow(t.size+e.size,2))),jK=(t,e)=>{if(!t||!_(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[wL]:null==n?void 0:n[wL],[TL]:null==n?void 0:n[TL]}};class zK extends YW{constructor(){super(...arguments),this.type=zK.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=vt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}zK.type="ripple";const HK=()=>{$W(),aw(),iL.registerMark(zK.type,zK),iL.registerGraphicComponent("symbol",(t=>nf(t)))},VK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class NK extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class WK extends MU{constructor(){super(...arguments),this.type=MI.correlation,this.transformerConstructor=NK,this._viewBox=new $e}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;MD(this._dataSet,"correlation",LK);const s=new io;wD(s,"dataview",za),MD(s,"correlationCenter",jK);const n=new so(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new EF(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const t=this._createMark(WK.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:wL});t&&(t.setMarkConfig({zIndex:eF.Node}),this._nodePointMark=t);const e=this._createMark(WK.mark.ripplePoint,{key:wL,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(WK.mark.centerPoint,{key:wL,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:eF.Node}),this._centerPointMark=i)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[OK],y:t=>t[RK],size:t=>t[IK],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},kF.STATE_NORMAL,sF.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},kF.STATE_NORMAL,sF.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},kF.STATE_NORMAL,sF.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},kF.STATE_NORMAL,sF.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),Jj("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}WK.type=MI.correlation,WK.mark=EK,WK.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},WK.transformerConstructor=NK;const UK=()=>{Lz(),HK(),iL.registerSeries(WK.type,WK),iL.registerAnimation("correlation",((t,e)=>Object.assign({appear:VK(0,e)},XF)))},GK={duration:2e3,loop:!0,channel:{wave:{from:0,to:1}}},YK=t=>({duration:2e3,channel:{wave:{from:0,to:1},height:t.height,dy:t.dy}}),$K=YK;function XK(t,e){switch(e){case"wave":default:return GK;case"grow":return YK(t);case"waveGrow":return $K(t)}}function KK(t,e){switch(e){case"wave":default:return GK;case"grow":case"waveGrow":return(t=>({duration:2e3,channel:{dy:t.dy}}))(t)}}const qK=Object.assign(Object.assign({},Wj),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class ZK extends YW{constructor(){super(...arguments),this.type=ZK.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}ZK.type="liquid";const JK=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class QK extends Ej{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class tq extends az{constructor(){super(...arguments),this.type=MI.liquid,this.transformerConstructor=Dz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=df({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=nf({x:s,y:n,size:r,symbolType:JK(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=$I(this._spec.outlineMargin),this._paddingSpec=$I(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(tq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(tq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(tq.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(tq.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",sF.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",sF.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",sF.Series)}initTooltip(){this._tooltipHelper=new QK(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(Zj(null===(i=iL.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),Jj("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(Zj(null===(s=iL.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),Jj("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(yD.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(r<e&&a>i){const e=Pw(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}tq.type=MI.liquid,tq.mark=qK,tq.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},tq.transformerConstructor=Dz;const eq=()=>{$W(),IM(),iL.registerMark(ZK.type,ZK),iL.registerGraphicComponent("area",(t=>If(t))),zF(),iL.registerAnimation("liquid",((t,e)=>({appear:XK(t,e),enter:XK(t,e),exit:XK(t,e)}))),iL.registerAnimation("liquidGroup",((t,e)=>({appear:KK(t,e),enter:KK(t,e),exit:KK(t,e)}))),iL.registerSeries(tq.type,tq)},iq=t=>Y(t).join(",");class sq extends Ej{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>iq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>iq(null==t?void 0:t[this.series.getDimensionField()[0]])}}const nq=Object.assign(Object.assign({},Wj),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}}),rq=t=>{switch(t){case"fadeIn":default:return{type:"fadeIn"};case"growIn":return{type:"growRadiusIn"};case"scaleIn":return{type:"scaleIn"}}},aq=t=>{switch(t){case"fadeIn":default:return{type:"fadeIn"};case"scaleIn":return{type:"scaleIn"}}};class oq extends BT{onBind(){var t,e;this.fromCircles={},null===(t=qY(this.target.attribute.arcs))||void 0===t||t.forEach((t=>{this.fromCircles[t.setId]=t})),this.toCircles={},null===(e=qY(this.target.getFinalAttribute().arcs))||void 0===e||e.forEach((t=>{this.toCircles[t.setId]=t}))}onUpdate(t,e,i){const s=[];Object.keys(this.fromCircles).forEach((t=>{const i=this.fromCircles[t],n=this.toCircles[t];i&&n&&s.push({radius:i.radius+(n.radius-i.radius)*e,x:i.x+(n.x-i.x)*e,y:i.y+(n.y-i.y)*e,setId:t})}));const n=XY(s);this.target.setAttributes({arcs:n,path:KY(n)})}}class lq extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const hq=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?ZY(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class cq extends az{constructor(){super(...arguments),this.type=MI.venn,this.transformerConstructor=lq,this._viewBox=new $e}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:CL)}initData(){var t;super.initData(),MD(this._dataSet,"venn",hq),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(cq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(cq.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},kF.STATE_NORMAL,sF.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},kF.STATE_NORMAL,sF.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},kF.STATE_HOVER,sF.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>iq(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},kF.STATE_NORMAL,sF.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>iq(t.sets)},kF.STATE_NORMAL,sF.Series))}initTooltip(){this._tooltipHelper=new sq(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:iq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return iq(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[iq(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(iq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),Jj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(Zj(null===(e=iL.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),Jj(t.name,this._spec,this._markAttributeContext)))}))}}cq.type=MI.venn,cq.mark=nq,cq.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},cq.transformerConstructor=lq;const dq=()=>{jU(),QN(),iL.registerAnimation("vennCircle",((t,e)=>({appear:rq(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:$F.disappear.duration}}))),iL.registerAnimation("vennOverlap",((t,e)=>({appear:aq(e),update:{custom:oq},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:$F.disappear.duration}}))),ZF(),iL.registerGrammarTransform("vennMark",{transform:JY}),iL.registerSeries(cq.type,cq)};class uq extends EN{constructor(){super(...arguments),this.type=MI.mosaic,this.transformerConstructor=PN}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(NL),this.setFieldX2(VL)),this.setFieldY(UL),this.setFieldY2(WL)):(t&&(this.setFieldY(NL),this.setFieldY2(VL)),this.setFieldX(UL),this.setFieldX2(WL)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=a%2?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}uq.type=MI.mosaic,uq.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},uq.transformerConstructor=PN;const pq=()=>{wN(),dU(),ZF(),UH(),iL.registerSeries(uq.type,uq)};class gq extends SV{_isValidSeries(t){return t===MI.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}let fq=class extends bV{constructor(){super(...arguments),this.transformerConstructor=gq,this.type="map",this.seriesType=MI.map}};fq.type="map",fq.seriesType=MI.map,fq.transformerConstructor=gq;const mq=()=>{iN(),uW(),iL.registerChart(fq.type,fq)};class vq extends SV{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class yq extends vq{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=Xz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,eL({},s,l)),n&&Object.assign(o,eL({},n,o))}}class _q extends vq{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class bq extends vq{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class xq extends bV{constructor(){super(...arguments),this.transformerConstructor=bq}}xq.transformerConstructor=bq;let Sq=class extends xq{constructor(){super(...arguments),this.transformerConstructor=bq,this.type="pie",this.seriesType=MI.pie}};Sq.type="pie",Sq.seriesType=MI.pie,Sq.transformerConstructor=bq;const kq=()=>{iN(),UU(),iL.registerChart(Sq.type,Sq)};class Aq extends _q{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:cH,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:cH,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>eL({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const Mq=(t,e)=>{if(!t)return null;const i=kz(t,(t=>"angle"===t.getOrient()),e),s=kz(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&hP(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=vI({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return t<s?t+=Math.ceil((s-t)/i)*i:t>n&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=yI(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=xz(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&hP(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=vI({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=yI(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=xz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};let wq=class extends bV{constructor(){super(...arguments),this.transformerConstructor=Aq,this.type="rose",this.seriesType=MI.rose}_setModelOption(){this._modelOption.getDimensionInfo=Mq}};wq.type="rose",wq.seriesType=MI.rose,wq.transformerConstructor=Aq,G(wq,CV);const Cq=()=>{tN(),iN(),EV(),PV(),hG(),iL.registerChart(wq.type,wq)};class Tq extends _q{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=eL({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>eL({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}let Bq=class extends bV{constructor(){super(...arguments),this.transformerConstructor=Tq,this.type="radar",this.seriesType=MI.radar}_setModelOption(){this._modelOption.getDimensionInfo=Mq}};Bq.type="radar",Bq.seriesType=MI.radar,Bq.transformerConstructor=Tq,G(Bq,CV);const Pq=()=>{tN(),iN(),nN(),EV(),PV(),yG(),iL.registerChart(Bq.type,Bq)};class Eq extends SV{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{O(e,"trimPadding")&&eL(e,tF(this.type,t))})),this._transformAxisSpec(t)}}let Oq=class extends bV{constructor(){super(...arguments),this.transformerConstructor=Eq,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=FV(t,e,i))&&void 0!==s?s:[],...null!==(n=Mq(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};Oq.type="common",Oq.transformerConstructor=Eq,G(Oq,CV);const Rq=()=>{tN(),iN(),nN(),EV(),iL.registerChart(Oq.type,Oq),PV()};class Iq extends SV{_getSeriesDataLength(t,e){var i,s;if(e.data){const t=Y(e.data)[0];return t instanceof so?null===(i=t.latestData)||void 0===i?void 0:i.length:null===(s=t.values)||void 0===s?void 0:s.length}const n=Y(t.data).find(((t,i)=>e.dataId?t instanceof so?t.name===e.dataId:t.id===e.dataId:e.dataIndex===i));return n?n instanceof so?n.latestData.length:n.values.length:0}addAttrToComponentSpec(t,e,i){return Array.isArray(t)?t[0][e]=i:t[e]=i,t}addPaddingRow(t,e,i){t.push({index:e,size:i})}addOrientAxes(t,e,i,s){t.push({id:`regionAxesRow${i}`}),e.push({modelId:`axesRow${i}`,col:1,row:i}),s.axes[0].id=`axesRow${i}`,s.axes[0].regionIndex=Array.from(Array(s.series.length),((t,e)=>"top"===s.axes[0].orient?e+1:e))}transformSpec(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;super.transformSpec(t);let m=0;const v=[],y=[],_=[],b=[],x=[],S=this._option.getCompiler().getStage(),k=(S.viewWidth,S.viewHeight);let A=0;if(null==t?void 0:t.legends){v.push({modelId:`legendRow${m}`,col:1,row:m}),this.addAttrToComponentSpec(t.legends,"id",`legendRow${m}`);const o=Y(t.legends);let l=null!==(e=o[0].height)&&void 0!==e?e:40;if(o[0].padding){const t=$I(o[0].padding);l+=Number(null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0),l+=Number(null!==(s=null==t?void 0:t.top)&&void 0!==s?s:0),o[0].offsetY=Number(null!==(r=null===(n=o[0])||void 0===n?void 0:n.offsetY)&&void 0!==r?r:0)+Number(null!==(a=null==t?void 0:t.top)&&void 0!==a?a:0)}x.push({index:m,size:l}),A+=l,m++}(null==t?void 0:t.dataZoom)&&(v.push({modelId:`dataZoomRow${m}`,col:1,row:m}),this.addAttrToComponentSpec(t.dataZoom,"id",`dataZoomRow${m}`),A+=60,m++,this.addPaddingRow(x,m,10),A+=10,m++),A+=60,null!==t.axes&&"top"!==(null===(l=null===(o=null==t?void 0:t.axes)||void 0===o?void 0:o[0])||void 0===l?void 0:l.orient)||(this.addOrientAxes(y,v,m,t),m++);const M=t.series.filter((t=>t.type!==MI.link)).length,w=(k-A-20*M)/M,C=(null===(h=null==t?void 0:t.appendPadding)||void 0===h?void 0:h.left)||0,T=(null===(c=null==t?void 0:t.appendPadding)||void 0===c?void 0:c.right)||0;null===(d=null==t?void 0:t.series)||void 0===d||d.forEach((e=>{var i,s;if([MI.bar,MI.line,MI.area,MI.dot].includes(e.type)){if(v.push({modelId:`${e.type}Row${m}`,col:1,row:m}),v.push({modelId:`axesLeftRow${m}`,col:0,row:m}),y.push({id:`${e.type}Row${m}`,clip:!1}),x.push({index:m,size:(null==e?void 0:e.height)||w}),_.push({orient:"left",id:`axesLeftRow${m}`,type:e.type===MI.dot?"band":"linear",visible:e.type!==MI.dot,title:{visible:!0,autoRotate:!1,style:{text:null==e?void 0:e.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof(null===(i=null==e?void 0:e.grid)||void 0===i?void 0:i.visible)||(null===(s=null==e?void 0:e.grid)||void 0===s?void 0:s.visible),style:(t,i)=>{var s,n,r,a,o;let l=0;if(0===i){const t=null===(s=null==e?void 0:e.grid)||void 0===s?void 0:s.style;l=null!==(r=null!==(n=null==t?void 0:t.lineWidth)&&void 0!==n?n:null==t?void 0:t.strokeWidth)&&void 0!==r?r:1}return{lineWidth:l,stroke:(null===(o=null===(a=null==e?void 0:e.grid)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:y.length-1}),e.type===MI.dot){v.push({modelId:`scrollBarRightRow${m}`,col:2,row:m});const i=this._getSeriesDataLength(t,e);let s=0;i&&(s=((null==e?void 0:e.height)||w)/(30*i)),b.push(Object.assign({orient:"right",visible:e.type===MI.dot&&s<1,id:`scrollBarRightRow${m}`,start:0,end:Math.min(s,1),filterMode:"axis",regionIndex:y.length-1,axisId:`axesLeftRow${m}`},Y(null==t?void 0:t.scrollBar)[0]))}e.regionIndex=y.length-1,m++,this.addPaddingRow(x,m,(null==e?void 0:e.padding)||20),m++,e.leftAppendPadding=C,e.type===MI.dot&&(e.title.style.dx=-C,e.subTitle.style.dx=-C)}})),this.addPaddingRow(x,m,20),m++,null===(u=null==t?void 0:t.series)||void 0===u||u.forEach((e=>{if(e.type===MI.link){const i=e.dotSeriesIndex+1;v.push({modelId:`${e.type}Row${i}`,col:1,row:i-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=C,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),(null==t?void 0:t.legends)&&this.addAttrToComponentSpec(t.legends,"regionIndex",[y.length-1]),"bottom"===(null===(g=null===(p=null==t?void 0:t.axes)||void 0===p?void 0:p[0])||void 0===g?void 0:g.orient)&&(this.addOrientAxes(y,v,m,t),m++);const B={type:"grid",col:4,row:m,colWidth:[{index:0,size:C},{index:2,size:12},{index:3,size:T}],rowHeight:x,elements:v};t.layout=B,t.region=y,null===(f=t.axes)||void 0===f||f.push(..._),t.scrollBar=b}}var Lq=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};let Dq=class extends bV{constructor(){super(...arguments),this.transformerConstructor=Iq,this.type="sequence"}_createSeries(t,e){if(!t)return;const{spec:i}=e,s=Lq(e,["spec"]);let n;if(i.type===MI.link&&(i.dotSeriesSpec=this._spec.series[i.dotSeriesIndex]),i.regionId&&(n=this.getRegionsInUserId(i.regionId)),n||(n=this.getRegionsInIndex(i.regionIndex?[i.regionIndex]:void 0)[0]),!n)return;const r=new t(i,Object.assign(Object.assign(Object.assign({},this._modelOption),s),{region:n,specKey:"series",globalScale:this._globalScale}));r&&(r.created(),this._series.push(r),n.addSeries(r))}};Dq.type="sequence",Dq.transformerConstructor=Iq;const Fq=()=>{tN(),iN(),AG(),BG(),XH(),UH(),iL.registerChart(Dq.type,Dq)};class jq extends kV{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class zq extends bV{constructor(){super(...arguments),this.transformerConstructor=jq}}zq.transformerConstructor=jq,G(zq,CV);class Hq extends jq{transformSpec(t){super.transformSpec(t),ZD(t)}}let Vq=class extends zq{constructor(){super(...arguments),this.transformerConstructor=Hq,this.type="histogram",this.seriesType=MI.bar}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};Vq.type="histogram",Vq.seriesType=MI.bar,Vq.transformerConstructor=Hq;const Nq=()=>{tN(),iN(),nN(),EV(),PV(),ON(),iL.registerTransform("bin",oa),iL.registerChart(Vq.type,Vq)};class Wq extends yq{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}let Uq=class extends bV{constructor(){super(...arguments),this.transformerConstructor=Wq,this.type="circularProgress",this.seriesType=MI.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=Mq}};Uq.type="circularProgress",Uq.seriesType=MI.circularProgress,Uq.transformerConstructor=Wq,G(Uq,CV);const Gq=()=>{tN(),iN(),EV(),PV(),jG(),iL.registerChart(Uq.type,Uq)};class Yq extends yq{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=MI.circularProgress,e}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===MI.gauge||t.type===MI.circularProgress));u(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(u(a.radiusField)&&u(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),u(a.valueField)&&u(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===MI.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:eF.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),u(i.angle.type)&&(i.angle.type="linear"),u(i.radius.type)&&(i.radius.type="linear"),u(i.angle.zIndex)&&(i.angle.zIndex=eF.Region+50)}}let $q=class extends bV{constructor(){super(...arguments),this.transformerConstructor=Yq,this.type="gauge",this.seriesType=MI.gaugePointer}};$q.type="gauge",$q.seriesType=MI.gaugePointer,$q.transformerConstructor=Yq;const Xq=()=>{iN(),bK(),kK(),jG(),iL.registerChart($q.type,$q)};class Kq extends SV{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class qq extends bV{constructor(){super(...arguments),this.transformerConstructor=Kq,this.type="wordCloud",this.seriesType=MI.wordCloud}}qq.transformerConstructor=Kq;let Zq=class extends qq{constructor(){super(...arguments),this.transformerConstructor=Kq,this.type="wordCloud",this.seriesType=MI.wordCloud}};Zq.type="wordCloud",Zq.seriesType=MI.wordCloud,Zq.transformerConstructor=Kq;const Jq=()=>{iN(),X$(),iL.registerChart(Zq.type,Zq)},Qq=()=>{iL.registerGrammarTransform("wordcloudShape",{transform:Y$}),iL.registerGrammarTransform("wordcloud",{transform:A$}),dU(),eY(),iL.registerSeries($$.type,$$),iN(),X$(),iL.registerChart(Zq.type,Zq)};class tZ extends SV{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}let eZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=tZ,this.type="funnel",this.seriesType=MI.funnel}};eZ.type="funnel",eZ.seriesType=MI.funnel,eZ.transformerConstructor=tZ;const iZ=()=>{iN(),gX(),iL.registerChart(eZ.type,eZ)};class sZ extends kV{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=Xz(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=Xz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}let nZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="linearProgress",this.seriesType=MI.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};nZ.type="linearProgress",nZ.seriesType=MI.linearProgress,nZ.transformerConstructor=sZ,G(nZ,CV);const rZ=()=>{tN(),iN(),EV(),PV(),GG(),iL.registerChart(nZ.type,nZ)};class aZ extends kV{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),ZD(t)}}let oZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=aZ,this.type="rangeColumn",this.seriesType=MI.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};oZ.type="rangeColumn",oZ.seriesType=MI.rangeColumn,oZ.transformerConstructor=aZ;const lZ=()=>{tN(),iN(),EV(),PV(),bU(),iL.registerChart(oZ.type,oZ)};class hZ extends SV{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let cZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=hZ,this.type="sunburst",this.seriesType=MI.sunburst}};cZ.type="sunburst",cZ.seriesType=MI.sunburst,cZ.transformerConstructor=hZ;const dZ=()=>{iN(),OX(),iL.registerChart(cZ.type,cZ)};class uZ extends SV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let pZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=uZ,this.type="circlePacking",this.seriesType=MI.circlePacking}};pZ.type="circlePacking",pZ.seriesType=MI.circlePacking,pZ.transformerConstructor=uZ;const gZ=()=>{iN(),jX(),iL.registerChart(pZ.type,pZ)};class fZ extends SV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let mZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="treemap",this.seriesType=MI.treemap}};mZ.type="treemap",mZ.seriesType=MI.treemap,mZ.transformerConstructor=fZ;const vZ=()=>{iN(),cK(),iL.registerChart(mZ.type,mZ)};class yZ extends RN{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),ZD(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}let _Z=class extends IN{constructor(){super(...arguments),this.transformerConstructor=yZ,this.type="waterfall",this.seriesType=MI.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};_Z.type="waterfall",_Z.seriesType=MI.waterfall,_Z.transformerConstructor=yZ;const bZ=()=>{tN(),iN(),nN(),EV(),PV(),VW(),iL.registerChart(_Z.type,_Z)};class xZ extends kV{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),ZD(t)}}let SZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=xZ,this.type="boxPlot",this.seriesType=MI.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};SZ.type="boxPlot",SZ.seriesType=MI.boxPlot,SZ.transformerConstructor=xZ;const kZ=()=>{tN(),iN(),EV(),PV(),hU(),iL.registerTransform("boxplot",la),iL.registerChart(SZ.type,SZ)};class AZ extends SV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let MZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=AZ,this.type="sankey",this.seriesType=MI.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=pD(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}};MZ.type="sankey",MZ.seriesType=MI.sankey,MZ.transformerConstructor=AZ;const wZ=()=>{iN(),$o.load(kw),iK(),iL.registerChart(MZ.type,MZ)};class CZ extends kV{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),ZD(t)}}let TZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=CZ,this.type="rangeArea",this.seriesType=MI.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};TZ.type="rangeArea",TZ.seriesType=MI.rangeArea,TZ.transformerConstructor=CZ;const BZ=()=>{tN(),iN(),nN(),EV(),PV(),AU(),iL.registerChart(TZ.type,TZ)};class PZ extends kV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}let EZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=PZ,this.type="heatmap",this.seriesType=MI.heatmap}};EZ.type="heatmap",EZ.seriesType=MI.heatmap,EZ.transformerConstructor=PZ;const OZ=()=>{iN(),PK(),iL.registerChart(EZ.type,EZ)};class RZ extends SV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let IZ=class extends bV{constructor(){super(...arguments),this.transformerConstructor=RZ,this.type="correlation",this.seriesType=MI.correlation}};IZ.type="correlation",IZ.seriesType=MI.correlation,IZ.transformerConstructor=RZ;const LZ=()=>{iN(),UK(),iL.registerChart(IZ.type,IZ)};function DZ(t){var e,i;const s=Object.assign({},t);return E(t.style)||(s.textStyle=uD(t.style)),E(t.textStyle)||eL(s.textStyle,uD(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&uD(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&uD(s.background.style),s}var FZ=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};const jZ=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},zZ=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:TL;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class HZ extends _H{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=eF.Legend,this.layoutLevel=iF.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{bI(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),bI(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=WI(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(W(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new EF(this._option,t),this._initSelectedData(),bI(this._regions,(t=>{t.event.on(yD.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;u(t)||JSON.stringify(n)===JSON.stringify(t)||(bI(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(yD.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)W(s,this._cacheAttrs)||this._legendComponent.setAttributes(eL({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(eL({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t,this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());W(t,this._cacheAttrs)||this._legendComponent.setAttributes(eL({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(yD.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}HZ.specKey="legends";class VZ extends HZ{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return xj(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),bI(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:FD.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){MD(this._option.dataSet,"discreteLegendFilter",zZ),MD(this._option.dataSet,"discreteLegendDataMake",jZ);const t=new so(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return bI(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!ix(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=ZL(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=Object.assign(Object.assign({layout:e,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,e){const i=FZ(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:s={},item:n={},pager:r={},background:a={}}=t;s=L(s),n=L(n),r=L(r),a=L(a);const o=i;return s.visible?o.title=DZ(s):o.title={visible:!1},E(n.focusIconStyle)||uD(n.focusIconStyle),n.shape&&(n.shape=hD(n.shape)),n.label&&(n.label=hD(n.label)),n.value&&(n.value=hD(n.value)),n.background&&(n.background=hD(n.background)),UI(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),UI(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),UI(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),o.item=n,"scrollbar"===r.type?(E(r.railStyle)||uD(r.railStyle),E(r.sliderStyle)||uD(r.sliderStyle)):(E(r.textStyle)||uD(r.textStyle),r.handler&&hD(r.handler)),o.pager=r,a.visible&&!E(a.style)&&(eL(o,a.style),p(a.padding)&&(o.padding=a.padding)),o}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return TR}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(xR.legendItemClick,(e=>{const i=O(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(yD.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(xR.legendItemHover,(t=>{const e=O(t,"detail");this.event.emit(yD.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(xR.legendItemUnHover,(t=>{const e=O(t,"detail");this.event.emit(yD.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=bj(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=bj(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}VZ.specKey="legends",VZ.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},VZ.type=r.discreteLegend;const NZ=()=>{iL.registerComponent(VZ.type,VZ)},WZ=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;A(n)&&(t=Math.min(n,t)),A(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},UZ=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!E(o)){const[e,i]=o;return a?a(t,o,l):h(t)?lD(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};var GZ=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};const YZ={color:RR,size:LR},$Z={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},XZ=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},$Z),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},KZ={horizontal:XZ(!0),vertical:XZ(!1)},qZ=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},$Z),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},ZZ={horizontal:qZ(!0),vertical:qZ(!1)},JZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],QZ=[2,10];let tJ=class extends HZ{static getSpecInfo(t){const e=xj(t,this.specKey,this.type,(t=>function(t){return"color"===t||"size"===t}(t.type)));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),bI(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:FD.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){MD(this._option.dataSet,"continuousLegendFilter",UZ),MD(this._option.dataSet,"continuousLegendDataMake",WZ);const t=new so(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>xI(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=ZL(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!ix(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=ZL(this._option.dataSet.getDataView(a.dataId),a.fields[0])}}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),E(r)&&(r="color"===this._legendType?JZ:QZ);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},function(t){const e=eL({},t),{title:i={},handler:s={},rail:n={},track:r={},startText:a,endText:o,handlerText:l,sizeBackground:h,background:c={},type:d,id:u,visible:g,orient:f,position:m,data:v,defaultSelected:y,field:_,filter:b,regionId:x,regionIndex:S,seriesIndex:k,seriesId:A,padding:M}=e,w=GZ(e,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return i.visible?w.title=DZ(i):w.title={visible:!1},w.showHandler=!1!==s.visible,E(s.style)||(w.handlerStyle=uD(s.style)),p(n.width)&&(w.railWidth=n.width),p(n.height)&&(w.railHeight=n.height),E(n.style)||(w.railStyle=uD(n.style)),E(r.style)||(w.trackStyle=uD(r.style)),w.startText=hD(a),w.endText=hD(o),w.handlerText=hD(l),E(h)||(w.sizeBackground=uD(h)),c.visible&&!E(c.style)&&(eL(w,c.style),p(c.padding)&&(w.padding=c.padding)),w}(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return YZ[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((e=>{const i=O(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(yD.legendFilter,{model:this,value:i,event:e})}),30))}}};tJ.specKey="legends",tJ.builtInTheme={colorLegend:KZ,sizeLegend:ZZ},tJ.type=r.continuousLegend;const eJ=()=>{iL.registerComponent(tJ.type,tJ)},iJ=(t,e)=>p(e)?t.map((t=>e[t])):void 0,sJ=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),nJ=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);const rJ=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=iJ(c,t);let y=iJ(d,t);const _=nJ(y),b=!_&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(sJ(c,v));if(!_&&(y=iJ(d,i),!nJ(y)))return;const n=e.type===MI.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=hP(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(sJ(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=iJ(d,o),!nJ(y))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(sJ(c,n));if(!_&&(y=iJ(d,r),!nJ(y)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===MI.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(sJ(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=iJ(d,i),!nJ(y))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(sJ(c,v));const o=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>t.properties[e]===(null==v?void 0:v[i])))));let l=y;if(o&&!a&&(a=Object.assign({},t)),!_){if(y=iJ(d,a),l=y,!nJ(y)&&!a)return;y=[null]}const h=e.type===MI.pie?e.dataToCentralPosition(o.properties):e.dataToPosition(o.properties);u(h)||isNaN(h.x)||isNaN(h.y)||s.push({pos:h,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:l,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},aJ=t=>p(t)&&!_(t),oJ=t=>p(t)&&_(t);class lJ extends fH{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=eL({},this._theme,r.style),r.offset=eL({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:Jb(this._option.mode)||!qb(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=o_.getElementById(t.parentElement)):qb(this._option.mode)&&(t.parentElement=null==Kb?void 0:Kb.body)}}let hJ=class extends _H{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=lJ,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=qb(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s<n;s++){const n=a[s],o=!!this.processor[n]&&this._showTooltipByMouseEvent(n,i,t,e);if("unShowByOption"===o)r[n]="unShowByOption";else if(o){r[n]=!0;break}}Object.values(r).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&aJ(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&mj.globalConfig.uniqueTooltip&&l&&mj.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(yD.tooltipHide,Object.assign(Object.assign({},t),{source:_D.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:_D.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(yD.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(yD.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?KV.canvas:KV.dom,n=iL.getComponentPluginInType(t);n||Yb("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=iL.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(Zb(s)||Jb(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))})),i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,St(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=function(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=rJ(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>sJ(i,s)(t)&&sJ(n,r)(t)&&(u(a)||sJ([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),k=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:_D.chart,event:k({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return mj.globalConfig.uniqueTooltip&&mj.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:_D.chart,event:k(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return mj.globalConfig.uniqueTooltip&&mj.hideTooltip(a.id),m}return"none"}(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(oJ(t)){if(aJ(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>_z(t,e[i])))}if(oJ(this._cacheInfo))return!1;const s=this._cacheInfo;if((null==t?void 0:t.datum)!==s.datum||(null==t?void 0:t.mark)!==s.mark||(null==t?void 0:t.series)!==s.series)return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&n.mark===e.mark&&n.model===e.model&&n.datum===e.datum}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}};hJ.type=r.tooltip,hJ.transformerConstructor=lJ,hJ.builtInTheme={tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}}},hJ.specKey="tooltip";const cJ=()=>{iL.registerComponent(hJ.type,hJ)};var dJ;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(dJ||(dJ={}));var uJ=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};const pJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class gJ extends _H{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=eF.CrossHair_Grid,this.labelZIndex=eF.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{hP(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||W(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:bD.chart}:{source:_D.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:t=n["desktop-browser"]}=this._option,e=function(t){return t===n["desktop-browser"]||t===n["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Zb(t)||Jb(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=Y(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(yD.tooltipHide,{source:_D.chart},this._handleTooltipHideOrRelease),this.event.on(yD.tooltipShow,{source:_D.chart},this._handleTooltipShow),this.event.on(yD.tooltipRelease,{source:_D.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=O(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{pJ[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,e){var i,s,n;const r={},{line:a={},label:o={},visible:l}=t;if(r.visible=l,r.type=a.type||"line",!1===a.visible)r.style={visible:!1};else{const e=a.style||{},{stroke:n,fill:o,lineWidth:l}=e,h=e,{strokeOpacity:c,fillOpacity:d,opacity:u}=h,p=uJ(h,["strokeOpacity","fillOpacity","opacity"]),g="line"===r.type;let f=g?c:d;if(S(u)&&(f=(null!=f?f:1)*u),r.style=Object.assign({opacity:f,pickable:!1,visible:!0},p),g)r.style.stroke=n||o,r.style.lineWidth=O(a,"width",l||2);else{r.style.fill=o||n,(null===(s=null===(i=null==t?void 0:t.line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.stroke)&&(r.style.stroke=t.line.style.stroke);const e=O(a,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;r.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(r.style.size=e)}}if(o.visible){const t=o.labelBackground||{},e=null!==(n=o.syncAxisLabelAngle)&&void 0!==n&&n,i=o.style||{},s=t.style||{},{fill:a="rgba(47, 59, 82, 0.9)",stroke:l,outerBorder:h}=s,d=uJ(s,["fill","stroke","outerBorder"]);r.label={visible:!0,formatMethod:o.formatMethod,formatter:o.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:e,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:O(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:a,stroke:l,outerBorder:Object.assign({stroke:a,distance:0,lineWidth:3},h)},d):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else r.label={visible:!1};return r}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;if(a=e,o=i,((r=s).x1>a||r.x2<a||r.y1>o||r.y2<o)&&t.delete(n.getSpecIndex()),n.type.startsWith("polarAxis")){const s=n.getCenter(),r=n.getInnerRadius(),a=n.getOuterRadius(),o=ae.distancePP({x:e,y:i},s);(o>a||o<r)&&t.delete(n.getSpecIndex())}var r,a,o})),t}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new Kw(e),null==s||s.add(t),i(t)),function(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;a<i&&(u=i-a),o<s&&(p=s-o),l>n&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}gJ.specKey="crosshair";const fJ={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class mJ extends gJ{static getSpecInfo(t){return xj(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=cz(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){cz(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:dz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=SI(this._regions,"cartesian");e&&(HV(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=WV(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new gC(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new fC(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}mJ.specKey="crosshair",mJ.builtInTheme={crosshair:fJ},mJ.type=r.cartesianCrosshair;const vJ=()=>{iL.registerComponent(mJ.type,mJ)};class yJ extends gJ{static getSpecInfo(t){return xj(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=SI(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=$z(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=bj(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=vt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new gC(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new vC(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else e="polygon"==(c?"circle":"polygon")?new yC(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new mC(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}));this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}yJ.specKey="crosshair",yJ.builtInTheme={crosshair:fJ},yJ.type=r.polarCrosshair;const _J=()=>{iL.registerComponent(yJ.type,yJ)},bJ=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},xJ=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},SJ=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),(f?g:!1===r||m?g.sort(((t,e)=>t-e)):c).forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},kJ=(t,e,i)=>{const s=e.domain();if(oP(e.type))return i?s[0]+($(s)-s[0])*(1-t):s[0]+($(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+($(n)-n[0])*t;return e.invert(r)},AJ=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&oP(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/($(n)-n[0])))},MJ=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},wJ=t=>{const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}},CJ=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),TJ=(t,e,i)=>{if(oP(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class BJ{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=vt(this.getState().start+f,0,1),y=vt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Wt(s/n)>=.5:Wt(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===gz(pz(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(BJ,aW);class PJ extends _H{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:AJ(t,this._stateScale,this._isHorizontal),a="percent"===n?e:AJ(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var t;this._dataFilterEvent.initZoomEvent(),null===(t=this._relatedAxisComponent)||void 0===t||t.event.on(yD.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-t<this._minSpan||e-t>this._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=MJ(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=TJ(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&wJ(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else bI(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),bI(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=pz(t),this._isHorizontal="horizontal"===gz(this._orient),this._dataFilterEvent=new BJ(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||W(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(oP(n.type)){const r=n.domain(),a=r[0],o=$(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>gz(t._orient)===gz(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!oP(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}}_initData(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};bI(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=oP(d.getScale(0).type),p=oP(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else bI(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:r}=this._option;wD(r,"dataview",za),MD(r,"dataFilterComputeDomain",SJ);const a=new so(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new EF(this._option,a),a.reRunAllTransform(),r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(MD(this._option.dataSet,"dataFilterWithNewDomain",xJ),MD(this._option.dataSet,"lockStatisticsFilter",bJ),bI(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>oP(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>oP(this._stateScale.type)},level:FD.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(oP(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!W(this._domainCache,e)&&(this._domainCache=e,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;CJ("start",i,this._spec)&&CJ("end",s,this._spec)&&(t="percent"===i?this._spec.start:AJ(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:AJ(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?AJ(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?AJ(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=kJ(this._start,this._stateScale,MJ(i,this._isHorizontal)),this._endValue=kJ(this._end,this._stateScale,MJ(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,oP(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=TJ(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&bI(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);A(null==i?void 0:i.min)&&A(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new QP:new OP,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:sF.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=wJ(h);if(!this._dataUpdating&&hP(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,hP(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=!(u(t)&&u(e)||0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(PJ,aW);class EJ extends fH{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=eL({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const OJ=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),RJ={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},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}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:OJ(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:OJ(!0)};let IJ=class extends PJ{constructor(t,e){var i;super(t,e),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=EJ,this.specKey="dataZoom",this.layoutZIndex=eF.DataZoom,this.layoutLevel=iF.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange)if(i&&this._component)this._component.setStartAndEnd(t,e);else{const i=this._relatedAxisComponent,n=kJ(t,this._stateScale,MJ(i,this._isHorizontal)),r=kJ(e,this._stateScale,MJ(i,this._isHorizontal));if(!p(n)||!p(r))return;this._start=t,this._end=e,(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(yD.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new QP),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(MJ(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=MJ(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new QP;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(MJ(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return!(oP(t.type)&&e[0]===$(e)||hP(t.type)&&1===(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:MJ(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=this._isHorizontal?this._stateScale:this._valueScale,i=this._isHorizontal?this._valueScale:this._stateScale,s=this._isScaleValid(e)&&this._isScaleValid(i)&&!1!==this._spec.showBackgroundChart,n=this._getAttrs(s),r=this._relatedAxisComponent;if(this._component)this._component.setAttributes(n),t&&(this._component.setPreviewData(this._data.getDataView().latestData),s&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>kJ(t,this._stateScale,MJ(r,this._isHorizontal))))));else{const t=this.getContainer();this._component=new SO(n),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?s&&this._component.setPreviewPointsY1(this._dataToPositionY2):s&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>kJ(t,this._stateScale,MJ(r,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:uD(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:uD(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:uD(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:uD(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:uD(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:uD(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:uD(g.style)},selectedBackgroundStyle:uD(this._spec.selectedBackground.style),dragMaskStyle:uD(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:eL(uD(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},uD(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:eL(uD(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},uD(null===(d=m.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=bj(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(MJ(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}};IJ.type=r.dataZoom,IJ.transformerConstructor=EJ,IJ.builtInTheme={dataZoom:RJ},IJ.specKey="dataZoom";const LJ=()=>{iL.registerComponent(IJ.type,IJ)};let DJ=class extends PJ{constructor(t,e){var i;super(t,e),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=eF.DataZoom,this.layoutLevel=iF.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}_handleChange(t,e,i){super._handleChange(t,e,i);const s=dI(this._start,t)&&dI(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=kJ(t,this._stateScale,!1),n=kJ(e,this._stateScale,!1);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(s,n))&&this.event.emit(yD.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._spec.auto&&this._data.getDataView().reRunAllTransform()}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new _w(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),E(null==t?void 0:t.style)||(s.railStyle=uD(t.style)),E(null==e?void 0:e.style)||(s.sliderStyle=uD(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}};DJ.type=r.scrollBar,DJ.builtInTheme={scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},DJ.specKey="scrollBar";const FJ=()=>{iL.registerComponent(DJ.type,DJ)},jJ=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},zJ=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),HJ={title:{visible:!0,autoLimit:!1,autoFit:!1,style:zJ("l1FontSize","primaryFontColor")},content:{visible:!0,style:zJ("l2FontSize","tertiaryFontColor")}};var VJ=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};let NJ=class extends _H{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=eF.Indicator,this.layoutLevel=iF.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return xj(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}initEvent(){this._option.disableTriggerEvent||"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(pD(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(pD(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){MD(this._option.dataSet,"indicatorFilter",jJ);const t=new so(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new EF(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:s,y:n}=t.getLayoutStartPoint(),r=this._spec,{content:a,offsetX:o,offsetY:l,limitRatio:h,title:c}=r,d=VJ(r,["content","offsetX","offsetY","limitRatio","title"]),u=[];return Y(a).forEach((t=>{const e=eL({},this._theme.content,t);u.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},dD(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:e,height:i},zIndex:this.layoutZIndex,x:s,y:n,dx:o?KI(o,this._computeLayoutRadius()):0,dy:l?KI(l,this._computeLayoutRadius()):0,limitRatio:h||1/0,title:{visible:!1!==c.visible&&(!p(c.field)||null!==this._activeDatum),space:c.space||this._gap,autoLimit:c.autoLimit,autoFit:c.autoFit,fitPercent:c.fitPercent,fitStrategy:c.fitStrategy,style:Object.assign(Object.assign({},dD(H(c.style,["text"]),this._activeDatum)),{text:this._createText(c.field,c.style.text)})},content:u},d)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)W(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new jR(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}};NJ.type=r.indicator,NJ.builtInTheme={indicator:HJ},NJ.specKey="indicator";const WJ=()=>{iL.registerComponent(NJ.type,NJ)},UJ=["sum","average","min","max","variance","standardDeviation","median"];var GJ=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};function YJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return e<n||e>r}function $J(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&YJ(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=UI(t.x)?ZJ(t.x,n)+r.x:JJ(l.getXAxisHelper(),[t.x])+r.x,h}function XJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&YJ(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=UI(t.y)?ZJ(t.y,n)+r.y:JJ(l.getYAxisHelper(),[t.y])+r.y,h}function KJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&YJ(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),JJ(a.angleAxisHelper,[t.angle])}function qJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&YJ(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),JJ(a.radiusAxisHelper,[t.radius])}function ZJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function JJ(t,e){const i=t.getScale(0);return oP(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function QJ(t){return UJ.includes(t)}function tQ(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),y=m.getScale(0).domain(),_=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},k={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=$J(t,y,n,u,c,o),r=XJ(t,_,n,u,d,o),eQ(s,b,S,g.length),eQ(r,x,k,g.length),g.push([{x:s,y:r}]);else if(e){s=$J(t,y,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);eQ(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=XJ(t,_,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);eQ(r,x,k,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,k),g}function eQ(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value<t)&&(i.max={value:t,index:s})),t}function iQ(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=KJ(t,l,n,r),i=qJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=KJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=qJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function sQ(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}function nQ(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=_(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=UI(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=UI(i)?Number(i.substring(0,i.length-1))*f/100:i)}const y=d.getXAxisHelper().getScale(0).domain(),_=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&YJ(y,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&YJ(_,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:JJ(d.getXAxisHelper(),b)+p.x+m,y:JJ(d.getYAxisHelper(),x)+p.y+v})})),n}function rQ(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&YJ(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&YJ(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:JJ(l.angleAxisHelper,d),radius:JJ(l.radiusAxisHelper,u)})})),s}function aQ(t,e,i){let{x:s,y:n}=t;return UI(s)&&(s=ZJ(s,e)),UI(n)&&(n=ZJ(n,i)),{x:s,y:n}}function oQ(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=aQ(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>aQ(t,n,r)))}function lQ(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.x<e&&(e=r.x),r.x+a.width>i&&(i=r.x+a.width),r.y<s&&(s=r.y),r.y+a.height>n&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function hQ(t,e,i){const{labelBackground:s={},style:n,shape:r}=t,a=GJ(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=a;return(null==r?void 0:r.visible)?t.shape=Object.assign({visible:!0},uD(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0,customShape:s.customShape},dQ(uD(s.style),e,i)),p(s.padding)&&(t.padding=ui(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=dQ(uD(n),e,i)),t}return{visible:!1}}function cQ(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function dQ(t,e,i){return d(t)?t(e,i):t}function uQ(t,e){return d(t)?t(e):t}function pQ(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function gQ(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function fQ(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=gQ(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function mQ(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=gQ(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function vQ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}var yQ=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};function _Q(t,e){let i;if(e.coordinates){const t=e,{coordinates:s,coordinateType:n,getSeriesByIdOrIndex:r}=t,a=yQ(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let o,l;if(d(s)){const t=e.getRelativeSeries();o=s(t.getData().getLatestData(),t)}else o=s;o=Y(o),i=o.map((t=>{const e=r(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===n){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:o,yFieldIndex:h}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(h)&&(d=Y(s)[h]),o&&Y(s).includes(o)&&(d=o),l=Object.assign({x:void 0,y:void 0},a),y(t[c])&&QJ(t[c])?l.x={field:c,aggrType:t[c]}:l.x=Y(c).map((e=>t[e])),y(t[d])&&QJ(t[d])?l.y={field:d,aggrType:t[d]}:l.y=Y(d).map((e=>t[e]))}else if("polar"===n){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let o=s;p(r)&&(o=Y(s)[r]),n&&Y(s).includes(n)&&(o=n);const h=i;l=Object.assign({angle:void 0,radius:void 0},a),y(t[o])&&QJ(t[o])?l.angle={field:o,aggrType:t[o]}:l.angle=Y(o).map((e=>t[e])),y(t[h])&&QJ(t[h])?l.radius={field:h,aggrType:t[h]}:l.radius=Y(h).map((e=>t[e]))}return l.getRefRelativeSeries=()=>e,l}))}else i=e;const s=[];return i.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>xQ(i,t,e))):i.x=xQ(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>xQ(i,t,e))):i.y=xQ(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>xQ(i,t,e))):i.angle=xQ(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>xQ(i,t,e))):i.radius=xQ(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=xQ(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),s.push(i)})),s}const bQ={min:(t,e)=>uI(t[0].latestData,e.field),max:(t,e)=>pI(t[0].latestData,e.field),sum:function(t,e){return gI(t[0].latestData,e.field)},average:function(t,e){return fI(t[0].latestData,e.field)},variance:function(t,e){return mI(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(mI(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function xQ(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(m(t)){const{aggrType:i,field:s}=t;return bQ[i](e,{field:s})}return t}function SQ(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class kQ extends _H{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return xj(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){return y(e)&&QJ(e)?{field:i.getSpec()[{x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"}[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new io;return e.registerParser("array",s),new so(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=SI(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=GI(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=GI(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return W(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();MD(this._option.dataSet,"markerAggregation",_Q),MD(this._option.dataSet,"markerFilter",SQ);const i=new so(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function AQ(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=uI(t,e),r=pI(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class MQ extends kQ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=eF.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=fQ(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:dQ(uD(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>hQ(t,this._markerData,this._markAttributeContext))),state:{line:cQ(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:cQ(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:cQ(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return cQ(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return cQ(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:dQ(uD(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:dQ(uD(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1},this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=lQ([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=fQ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;MD(this._option.dataSet,"markerAggregation",_Q),MD(this._option.dataSet,"markerRegression",AQ),MD(this._option.dataSet,"markerFilter",SQ);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new so(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}MQ.specKey="markLine";const wQ=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),CQ={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},TQ={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:wQ(!1),endSymbol:wQ(!0),label:CQ};class BQ extends MQ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new oR(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:y}=fQ(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=tQ(i,s,n,r,d);_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=nQ(i,r,d,e.coordinatesOffset):c&&(_=oQ(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(UI(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),y=Y(r.label),_=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:y.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=_[e])&&void 0!==n?n:_[0];return A(null==c?void 0:c.refX)&&(a+=c.refX),A(null==c?void 0:c.refY)&&(o+=c.refY),A(null==c?void 0:c.dx)&&(l+=c.dx),A(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=fQ(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new so(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}BQ.type=r.markLine,BQ.coordinateType="cartesian",BQ.builtInTheme={markLine:TQ};const PQ=()=>{iL.registerComponent(BQ.type,BQ),aR()};class EQ extends MQ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=fQ(this._spec);return e||i?new cR(t):new oR(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=fQ(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=iQ(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=rQ(i,r,a),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=fQ(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}EQ.type=r.polarMarkLine,EQ.coordinateType="polar",EQ.builtInTheme={polarMarkLine:TQ};const OQ=()=>{iL.registerComponent(EQ.type,EQ),cR._animate=VO,aR()};let RQ=class extends _H{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=eF.Title,this.layoutLevel=iF.Title,this._orient="top",this._orient=WI(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return xj(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){A(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),A(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:A(t.width())?t.width():0,height:this._spec.height?this._spec.height:A(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o;if(!1===this._spec.visible)return{visible:!1};const l=this.getLayoutRect(),h=GI(this._spec.width,l.width,null,l.width),c=GI(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtextType:null!==(i=this._spec.subtextType)&&void 0!==i?i:"text",subtext:null!==(s=this._spec.subtext)&&void 0!==s?s:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(r=this._spec.y)&&void 0!==r?r:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:d,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(a=this._spec.align)&&void 0!==a?a:"left",verticalAlign:null!==(o=this._spec.verticalAlign)&&void 0!==o?o:"top",textStyle:Object.assign({width:d,maxLineWidth:d},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:d},this._spec.subtextStyle)});return p(this._spec.width)&&(u.textStyle.width=Math.max(h,l.width),u.subtextStyle.width=u.textStyle.width),u}_createOrUpdateTitleComponent(t){if(this._titleComponent)W(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new DR(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}};RQ.type=r.title,RQ.specKey=r.title,RQ.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};const IQ=()=>{iL.registerComponent(RQ.type,RQ)};class LQ extends kQ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=eF.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=mQ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:dQ(uD(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>hQ(t,this._markerData,this._markAttributeContext))),state:{area:cQ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>cQ(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return cQ(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=lQ([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=mQ(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}LQ.specKey="markArea";const DQ={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class FQ extends LQ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new hR(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=mQ(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=tQ(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=tQ(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=nQ(s,a,u,i.coordinatesOffset):d&&(f=oQ(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=mQ(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}FQ.type=r.markArea,FQ.coordinateType="cartesian",FQ.builtInTheme={markArea:DQ};const jQ=()=>{iL.registerComponent(FQ.type,FQ),lR()};class zQ extends LQ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=mQ(this._spec);return i||e||s?new dR(t):new hR(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=mQ(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=iQ(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=rQ(i,r,c),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=mQ(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}zQ.type=r.polarMarkArea,zQ.coordinateType="polar",zQ.builtInTheme={polarMarkArea:DQ};const HQ=()=>{iL.registerComponent(zQ.type,zQ),dR._animate=WO,lR()},VQ=t=>uD(Object.assign({},t)),NQ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},uD(t.style))}),WQ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=VQ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=VQ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),y=(A=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},uD(Object.assign({},A))),_=NQ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),b=NQ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),x=NQ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),S=NQ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:y}),controller:Object.assign(Object.assign({},t.controller),{start:_,pause:b,backward:x,forward:S})});var A;return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},UQ=t=>"left"===t||"right"===t,GQ=t=>"top"===t||"bottom"===t;let YQ=class extends _H{constructor(){super(...arguments),this.layoutZIndex=eF.Player,this.layoutLevel=iF.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},WQ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},WQ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?W(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new JR(t):this._playerComponent=new eI(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=UQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=UQ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(yD.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(YR.end,(()=>{var t;this.event.emit(yD.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(YR.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(YR.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(yD.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(YR.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(yD.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(YR.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(yD.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(YR.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(yD.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),A(t.x)){const e=UQ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(A(t.y)){const e=GQ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):UQ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):GQ(this._orient)?this._maxSize():t.height}_computeDx(t){return UQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return GQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];this._option.globalInstance.updateFullData(e.data),this.event.emit(yD.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}};YQ.builtInTheme={player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}}},YQ.specKey="player",YQ.type=r.player;const $Q=()=>{iL.registerComponent(YQ.type,YQ)};class XQ extends _H{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=eF.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,W(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=RI({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==SF.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}XQ.type=r.label;class KQ extends cU{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}KQ.type="text",KQ.constructorType="label";const qQ=()=>{dU(),iL.registerMark(KQ.constructorType,KQ)};class ZQ extends fH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class JQ extends XQ{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=ZQ,this.layoutZIndex=eF.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[];return((null==e?void 0:e.region)||[]).forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(yD.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(mD.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(mD.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),bI(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n<i.length;n++){const r=i[n],a=t.getMarkInName(r);a&&e[r].forEach(((e,i)=>{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n),d(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",sF.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=eL({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},PW(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[HL])):t=>t.filter((t=>t.data[zL]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?EW(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}JQ.type=r.label,JQ.specKey="label",JQ.transformerConstructor=ZQ;const QQ=()=>{iL.registerGraphicComponent(JQ.type,(t=>new nO(t))),qQ(),xH(),iL.registerComponent(JQ.type,JQ,!0,1/0)};class t0 extends XQ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=eF.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[FL]},"normal",sF.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return eL({textStyle:{pickable:!0===this._spec.interactive},position:e0(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[HL]:t.data[zL]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>EW({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function e0(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}t0.type=r.totalLabel,t0.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},t0.specKey="totalLabel";const i0=()=>{iL.registerGraphicComponent(t0.type,(t=>new nO(t))),qQ(),xH(),iL.registerComponent(t0.type,t0,!0)};var s0=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};class n0 extends kQ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=eF.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=vQ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,k,A,M,w,C,T,B,P,E,O;const{itemContent:R={},itemLine:I={},targetSymbol:L={}}=this._spec,D=R,{type:F="text",text:j,symbol:H,image:V,richText:N,customMark:W,textStyle:U,symbolStyle:G,imageStyle:Y,richTextStyle:$,customMarkStyle:X,style:K={},state:q={}}=D,Z=s0(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(t=null==j?void 0:j.state)&&void 0!==t?t:q,tt={dx:0,dy:0},Q=hQ(Object.assign(Object.assign({},j),{style:z(tt,null!==(i=null!==(e=null==j?void 0:j.textStyle)&&void 0!==e?e:U)&&void 0!==i?i:K)}),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=dQ(z(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:$)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=uD(dQ(z(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=dQ(z(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==W?void 0:W.state)&&void 0!==u?u:q,Q=dQ(null!==(g=null!==(p=null==W?void 0:W.style)&&void 0!==p?p:X)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(y=this._spec.clip)&&void 0!==y&&y,itemContent:Object.assign(Object.assign({type:F,offsetX:uQ(R.offsetX,this._relativeSeries.getRegion()),offsetY:uQ(R.offsetX,this._relativeSeries.getRegion())},Z),{style:dQ(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(_=L.offset)&&void 0!==_?_:0,visible:null!==(b=L.visible)&&void 0!==b&&b,size:null!==(x=L.size)&&void 0!==x?x:20,style:dQ(L.style,this._markerData,this._markAttributeContext)},state:{line:cQ(null!==(k=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),lineStartSymbol:cQ(null!==(M=null===(A=this._spec.itemLine.startSymbol)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:cQ(null!==(C=null===(w=this._spec.itemLine.endSymbol)||void 0===w?void 0:w.state)&&void 0!==C?C:{},this._markerData,this._markAttributeContext),itemContent:cQ(J,this._markerData,this._markAttributeContext),textBackground:cQ(null===(B=null===(T=this._spec.itemContent.text)||void 0===T?void 0:T.labelBackground)||void 0===B?void 0:B.state,this._markerData,this._markAttributeContext),targetItem:cQ(null!==(E=null===(P=this._spec.targetSymbol)||void 0===P?void 0:P.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=I,nt=s0(I,["visible","line"]);return et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:uD(st.style)}):{visible:!1},new pR(et)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=lQ([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:pQ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:pQ(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=vQ(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}n0.specKey="markPoint";const r0={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class a0 extends n0{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=tQ(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=nQ(n,r,h,s.coordinatesOffset)[0]:l&&(c=oQ(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=vQ(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}a0.type=r.markPoint,a0.coordinateType="cartesian",a0.builtInTheme={markPoint:r0};const o0=()=>{iL.registerComponent(a0.type,a0),uR()};class l0 extends n0{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=iQ(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}l0.type=r.polarMarkPoint,l0.coordinateType="polar",l0.builtInTheme={polarMarkPoint:r0};const h0=()=>{iL.registerComponent(l0.type,l0),uR()};class c0 extends n0{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){return{point:sQ(this._markerData,this._relativeSeries)[0][0]}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}c0.type=r.geoMarkPoint,c0.coordinateType="geo",c0.builtInTheme={geoMarkPoint:r0};const d0=()=>{iL.registerComponent(c0.type,c0),uR()};let u0=class extends _H{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=eF.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return xj(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),"inBrush",sF.Series),i.setMarkStyle(s,Object.assign({},e),"outOfBrush",sF.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return W(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;super.onLayoutEnd(),this._option.disableTriggerEvent||(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new rI(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:uD(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(QR.brushActive,(i=>{this._initMarkBrushState(e,"outOfBrush"),this._emitEvent(yD.brushActive,t)})),r.addEventListener(QR.drawStart,(e=>{this._setRegionMarkPickable(t,!0),this._emitEvent(yD.brushStart,t)})),r.addEventListener(QR.moveStart,(e=>{this._setRegionMarkPickable(t,!0),this._emitEvent(yD.brushStart,t)})),r.addEventListener(QR.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(yD.brushChange,t)})),r.addEventListener(QR.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(yD.brushChange,t)})),r.addEventListener(QR.brushClear,(i=>{this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(yD.brushClear,t)})),r.addEventListener(QR.drawEnd,(i=>{var s;this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(yD.brushClear,t)):(this._spec.onBrushEnd(i),this._emitEvent(yD.brushEnd,t));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(yD.brushEnd,t)}})),r.addEventListener(QR.moveEnd,(e=>{this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec,n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(yD.brushEnd,t)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},uD(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState("inBrush",!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState("inBrush"),i.addState("outOfBrush",!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState("inBrush",!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState("inBrush"),i.addState("outOfBrush",!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i<e.length;i++){if(Fe(t,e[i].x,e[i].y))return!0;if(i>0&&De(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState("inBrush"),s.removeState("outOfBrush"),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?"width":"height",p=r?o:h,g=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=(p-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],n=(g-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],r=this._stateClamp(s-a),o=this._stateClamp(n+a);i.setStartAndEnd(Math.min(r,o),Math.max(r,o),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:r,end:o,startValue:kJ(r,i.stateScale,MJ(i.relatedAxisComponent,i.isHorizontal)),endValue:kJ(o,i.stateScale,MJ(i.relatedAxisComponent,i.isHorizontal))})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i)<i[0],o=p-e.getLayoutStartPoint()[d],l=g-e.getLayoutStartPoint()[d],h=r?Math.min(o,l):Math.max(o,l),c=r?Math.max(o,l):Math.min(o,l),u=(c-i[0])/($(i)-i[0])*(s[1]-s[0])+s[0],f=(h-i[0])/($(i)-i[0])*(s[1]-s[0])+s[0],m=this._stateClamp(u-a),v=this._stateClamp(f+a);t.scaleRangeFactor([m,v]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:m,end:v,startValue:t.getScale().invert(c),endValue:t.getScale().invert(h)})}}))}}_getNeedClearVRenderComponents(){return this._brushComponents}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}};u0.type=r.brush,u0.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},u0.specKey="brush";const p0=()=>{iL.registerComponent(u0.type,u0)};class g0 extends _H{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=eF.CustomMark,this.layoutLevel=iF.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${kL}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=Zj({},Jj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||A(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return W(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new $e).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new $e;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}g0.type=r.customMark,g0.specKey="customMark";const f0=()=>{iL.registerComponent(g0.type,g0)};class m0{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(A(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)&&(null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0;return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r<t[e]+(null!==(i=t[`${e}Span`])&&void 0!==i?i:1);r++)n+=s[r].value;return n}getSizeFromUser(t,e){var i,s;const n="col"===e?this._colSize:this._rowSize;if(!(null===(i=n[t[e]])||void 0===i?void 0:i.isUserSetting))return;let r=0;for(let i=t[e];i<t[e]+(null!==(s=t[`${e}Span`])&&void 0!==s?s:1);i++){if(!n[i].isUserSetting)return;r+=n[i].value}return r}setItemLayoutSizeToGrid(t,e){if(v0(t)){if(e.colSpan&&e.colSpan>1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;t<e.col;t++)i.x+=this._colSize[t].value;for(let t=0;t<e.row;t++)i.y+=this._rowSize[t].value;return i.x+=t.layoutPaddingLeft+t.layoutOffsetX,i.y+=t.layoutPaddingTop+t.layoutOffsetY,i}getItemLayoutRect(t){var e,i;const s=this.getItemGridInfo(t);return{width:(null!==(e=this.getSizeFromGrid(s,"col"))&&void 0!==e?e:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(i=this.getSizeFromGrid(s,"row"))&&void 0!==i?i:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom}}layoutItems(t,e,i,s){this._chartLayoutRect=i,this._chartViewBox=s,this.clearLayoutSize(),e.sort(((t,e)=>e.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>v0(t))),a=n.filter((t=>!v0(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>v0(t))),h=o.filter((t=>!v0(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);A(h.width)||(h.width=l.width),A(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function v0(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}m0.type="grid";const y0=()=>{$o.load(uC)},_0="vchart-tooltip",b0=`${_0}-container`,x0=`${_0}-title`,S0=`${_0}-content-box`,k0={offsetX:10,offsetY:10},A0="99999999999999";function M0(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\(/g,"(").replace(/ /g," ")}const w0=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,C0=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?M0(t):"",T0=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},B0={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},P0=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=B0[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class E0 extends Uz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:k,offsetY:M}=this._option,w=m[_],C=Mj(null==w?void 0:w.position,b,e),T=null!==(r=Mj(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:B=0,height:P=0}=null!=i?i:{},E="canvas"===m.renderMode,O=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==O?void 0:O.width)&&void 0!==o?o:AL,I=null!==(l=null==O?void 0:O.height)&&void 0!==l?l:ML;let L=!1;const D={width:0,height:0};let F,j={x:0,y:0},z={x:0,y:0},H=1,V=1;const N=qb(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=I),N&&!E){const t=this._getParentElement(m);z=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),j={x:F.x-z.x,y:F.y-z.y},H=w0(e,F),V=w0(t,z)}const W=V/H,U={},G={x:C,y:C},Y={x:["left","right"],y:["top","bottom"]},$=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?k:M;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:P;switch(P0(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},X=["x","y"];if(g(C))if(g(K=C)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=C;U.left=T0(t,y),U.top=T0(i,y),U.right=T0(e,y),U.bottom=T0(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(C)&&X.forEach((t=>{const e=C[t];S(e)||d(e)?U[Y[t][0]]=T0(e,y):$(e,t)}));else p(C)&&($({orient:C,mode:T},"x"),$({orient:C,mode:T},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?B:P,s="x"===t?R:I,n="x"===t?k:M,r=P0(G[t],t);if(A(U[Y[t][0]]))q[t]=U[Y[t][0]];else if(A(U[Y[t][1]]))q[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;q[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}q[t]*=H,N&&(q[t]+=j[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(z[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-z[t]/V,l=a/V+o-i;2!==r&&q[t]<o?L?q[t]=o:(q[t]+=0===r?n+i/2:2*n+i,q[t]>l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]<o&&(q[t]=o)))})),q}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i,s;const n=null!==(e=null===(t=this._component)||void 0===t?void 0:t.getSpec())&&void 0!==e?e:{};n.handler?null===(s=(i=n.handler).release)||void 0===s||s.call(i):(this._removeTooltip(),this._isReleased=!0,this._chartOption=null,this._component=null)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return i?{offsetX:null!==(t=i.x)&&void 0!==t?t:k0.offsetX,offsetY:null!==(e=i.y)&&void 0!==e?e:k0.offsetY}:k0}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}E0.specKey="tooltip";const O0=(t,e)=>p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",R0=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=O0(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=O0(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},I0=(t={})=>{const{lineHeight:e}=t;return t.fontSize?GI(e,t.fontSize):0},L0=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=A(l)?`${l}px`:`${l}`),r&&(o=ui(r),a.padding=O0(o)),{panelStyle:a,panelPadding:o}};function D0(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const F0=t=>{iL.registerComponentPlugin(t.type,t)};class j0 extends E0{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(j0.type),this.type=KV.dom,this._tooltipContainer=null==Kb?void 0:Kb.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Kb&&t&&t.children&&t.children.length){for(let e=0;e<t.children.length;e++)if(t.children[e].classList.contains(b0)){this._container=t.children[e];break}this._container||(this._container=Kb.createElement("div"),this._container.style.position="relative",this._container.style.zIndex=A0,this._container.classList.add(b0),t.appendChild(this._container))}}initRootDom(){var t;const e=this._component.getSpec(),i=document.createElement("div"),s=null===(t=this._chartOption)||void 0===t?void 0:t.getTheme("fontFamily");D0(i,Object.assign({left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:A0,fontFamily:null!=s?s:ZI.fontFamily,fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh",visibility:"hidden"},this._domStyle.panel)),i.classList.add(e.className),i.setAttribute("vchart-tooltip-id",`${this.id}`),this._container.appendChild(i),this._rootDom=i}_getTooltipBoxSize(t,e){var i;this._rootDom||this.initRootDom(),e||this._updateDomStringByCol(t),this._updateDomStyle("height",e);const s=null===(i=this._rootDom)||void 0===i?void 0:i.getBoundingClientRect();return{width:null==s?void 0:s.width,height:null==s?void 0:s.height}}_removeTooltip(){this._rootDom&&this._rootDom.parentNode&&(this._rootDom.parentNode.removeChild(this._rootDom),this._rootDom=null),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this._rootDom){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r);const a=this._rootDom;if(a){const{x:o=0,y:l=0}=null!==(i=r.position)&&void 0!==i?i:{};let h={x:o,y:l};const c=this.getVisibility();n.updateElement&&(this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:o,y:l}),n.updateElement(a,r,e),h=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight}),this._cacheCustomTooltipPosition=h),!c&&t&&(this._rootDom.style.transition="none",this._updatePosition(h,!1),this._rootDom.getBoundingClientRect()),this._updatePosition(h)}this.setVisibility(t)}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){const t=this._component.getSpec();this._domStyle=((t={})=>{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=L0(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),A(g)&&(y.marginBottom=`${g}px`);const _={width:O0(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=R0(h),x=R0(d),S=R0(p),k="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[k]=O0(null!==(i=c.spacing)&&void 0!==i?i:8),x[k]=O0(null!==(s=d.spacing)&&void 0!==s?s:26),S[k]=O0(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(I0(p),I0(d));return y.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(x0))),l=a.find((t=>t.className.includes(S0)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(x0),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(D0(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${_0}-column`),e.classList.add(`${_0}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(S0),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];D0(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));D0(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${_0}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=C0(e.key),e.keyStyle&&R0(e.keyStyle,l)):"value"===i?(o.innerHTML=C0(e.value),e.valueStyle&&R0(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?M0(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?M0(c):m,_=p,b=t=>new sf({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let k,A;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;A=t.toString(),k=t.bounds}else S.isSvg&&S.svgCache&&(A=S.svgCache.map((t=>t.path.toString())).join(),k=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new $e));let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=Wh.IsGradientStr(u);if(!u||y(u)&&!w||d)return m=d?"none":u?M0(u):"currentColor",`\n <svg ${l} width="${p}" height="${p}" viewBox="${M}">\n <path\n d="${A}"\n style="fill: ${m}; stroke: ${v()}; stroke-width: ${f}"\n >\n </path>\n </svg>`;const C=w?Wh.Parse(u):g(u)?u:null;if(C){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=C.stops)&&void 0!==s?s:[]).map((t=>`<stop offset="${M0(t.offset.toString())}" stop-color="${M0(t.color)}"/>`)).join("");return"radial"===C.gradient?t=`<radialGradient id="${m}" cx="50%" cy="50%" r="50%" fx="0%" fy="0%">\n ${i}\n </radialGradient>`:"linear"===C.gradient&&(t=`<linearGradient id="${m}" x1="${100*(null!==(n=C.x0)&&void 0!==n?n:0)}%" y1="${100*(null!==(r=C.y0)&&void 0!==r?r:0)}%" x2="${100*(null!==(a=C.x1)&&void 0!==a?a:0)}%" y2="${100*(null!==(o=C.y1)&&void 0!==o?o:0)}%">\n ${i}\n </linearGradient>`),`\n <svg ${l} width="${p}" height="${p}" viewBox="-0.5 -0.5 1 1">\n ${t}\n <path\n d="${A}"\n style="fill: url(#${m}); stroke: ${v()}; stroke-width: ${f}"\n >\n </path>\n </svg>`}return""}(e,`${this.id}_${a}`)),D0(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(S0))),h=[...o.children].find((t=>t.className.includes(x0)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(x0)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=GI(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,D0(l,c))}const u=l.children,g=[];if(u){for(let i=0;i<u.length;i++){const s=null!==(r=u[i].children)&&void 0!==r?r:[];for(let i=0;i<s.length;i++){e&&(s[i].style[t]="initial");const n=s[i].getBoundingClientRect()[t];(void 0===g[i]||g[i]<n)&&(g[i]=n)}}for(let e=0;e<u.length;e++){const i=null!==(a=u[e].children)&&void 0!==a?a:[];for(let e=0;e<i.length;e++)i[e].style[t]=`${g[e]}px`}}}}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle(),this._rootDom&&D0(this._rootDom,this._domStyle.panel),this.getVisibility()&&(this._updateDomStringByCol(this._tooltipActual),this._updateDomStyle("height",!1))}_updatePosition({x:t,y:e},i=!0){this._rootDom&&(this._rootDom.style.transform=`translate3d(${t}px, ${e}px, 0)`,i&&""!==this._rootDom.style.transition&&(this._rootDom.style.transition="",Object.assign(this._rootDom.style,this._domStyle.panel)))}}j0.type=KV.dom;const z0=()=>{F0(j0)},H0={fontFamily:ZI.fontFamily,spacing:10,wordBreak:"break-word"},V0=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>e<s.length-1?t+"\n":t))):s=[t],n=s.map((t=>Object.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},Kf||(Kf=$f.CreateGraphic("richtext",{})),Kf.setAttributes(a),Kf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function N0(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:H0),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const W0=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class U0 extends E0{constructor(){super(U0.type),this.type=KV.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new cI({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=ui(d.padding),b=$I(d.padding),x=N0(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=N0(Object.assign({textAlign:"right"===y?"right":"left"},f),i),k=N0(m,i),A={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},M={panel:W0(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:A,key:S,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:w={},content:C=[]}=t;let T=b.left+b.right,B=b.top+b.bottom,P=0;const E=!!C.length;let O=0,R=0,I=0,L=0;if(E){const t=[],e=[],i=[],s=[];let n=0;M.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:M}=r,w={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=eL({},S,N0(b,void 0,{})),{width:s,height:n,text:r}=V0(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=eL({},k,N0(x,void 0,{})),{width:e,height:s,text:n}=V0(m,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:A.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,a<C.length-1&&(n+=w.spaceRow),w})),B+=n,O=t.length?X(t):0,R=e.length?X(e):0,I=i.length?X(i):0,L=s.length?X(s)+A.spacing:0,P=Math.max(L+O+S.spacing+I+k.spacing,L+R,P),M.hasContentShape=!!s.length,M.keyWidth=O,M.valueWidth=I}let D=0,F=0,j=0;const{visible:z=!0,value:H="",valueStyle:V,spaceRow:N}=w;M.title.visible=z,M.title.spaceRow=null!=N?N:v;let W={};const U=()=>W.autoWidth&&!1!==W.multiLine;if(z){W=eL({},x,N0(V,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:E?Math.ceil(P):void 0);const{text:t,width:e,height:i}=V0(H,W);M.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),D=M.title.value.width,F=M.title.value.height,j=F+(E?M.title.spaceRow:0)}return B+=j,M.title.width=D,M.title.height=F,U()?T+=P||D:T+=Math.max(D,P),E&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=T-b.left-b.right-L-O-S.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=T,M.panel.height=B,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}U0.type=KV.canvas;const G0=()=>{F0(U0)},Y0=t=>{iL.registerChartPlugin(t.type,t)},$0=/\{([^}]+)\}/,X0=/\{([^}]+)\}/g,K0=/:/;class q0 extends Uz{constructor(){super(q0.type),this.type="formatterPlugin",this._timeModeFormat={utc:Ti.getInstance().timeUTCFormat,local:Ti.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Di.getInstance().format,this._numericSpecifier=Di.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[q0.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),iL.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;return this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=$0.test(i),this._isNumericFormatterCache.set(i,s))),s?i.replace(X0,((t,i)=>{if(!K0.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)})):this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ri.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}q0.pluginType="chart",q0.specKey="formatter",q0.type="formatterPlugin";const Z0={state:kF.STATE_ACTIVE,trigger:"pointerover",triggerOff:"pointerout"};class J0 extends lj{constructor(t){super(t),this.type="element-active",this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{this.reset(t.item)},this.options=Object.assign({},Z0,t),this.updateMarkIdByState([this.options.state])}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}getStartState(){return this.options.state}start(t){if(t){const{state:e,interaction:i}=this.options;this.isGraphicInStateMark(t,e)&&(t.addState(e,!0),i.setStatedGraphics(this,[t]))}}reset(t){const{interaction:e,state:i}=this.options,s=e.getStatedGraphics(this),n=null!=t?t:null==s?void 0:s[0];n&&s.includes(n)&&(n.removeState(i),e.setStatedGraphics(this,s.filter((t=>t!==n))))}}J0.type="element-active",J0.defaultOptions=Z0;const Q0="element-active-by-legend",t1={state:kF.STATE_ACTIVE,filterType:"groupKey"};class e1 extends lj{constructor(t){super(t),this.type=Q0,this.handleStart=t=>{var e,i;const s=t.event;s&&this.start(null===(i=null===(e=s.detail)||void 0===e?void 0:e.data)||void 0===i?void 0:i.id)},this.handleReset=t=>{this.resetAll()},this.options=Object.assign({},t1,t),this.updateMarkIdByState([this.options.state])}getEvents(){return[{type:yD.legendItemHover,handler:this.handleStart},{type:yD.legendItemUnHover,handler:this.handleReset}]}getStartState(){return this.options.state}start(t){if(u(t))return;const{interaction:e,state:i}=this.options,s=aj(this.options),n=e.getStatedGraphics(this),r=[];this.getMarks().forEach((e=>{var i;null===(i=e.getGraphics())||void 0===i||i.forEach((e=>{s(e)===t&&r.push(e)}))})),e.updateStates(this,r,n,i),e.setStatedGraphics(this,r)}resetAll(){const{interaction:t,state:e}=this.options;t.clearAllStatesOfTrigger(this,e),t.setStatedGraphics(this,[])}reset(t){const{state:e,interaction:i}=this.options;if(t){const s=i.getStatedGraphics(this);s&&s.includes(t)&&(t.removeState(e),i.setStatedGraphics(this,s.filter((e=>e!==t))))}else this.resetAll()}}e1.type=Q0,e1.defaultOptions=t1;const i1="element-highlight-by-group";class s1 extends lj{constructor(t){super(t),this.type=i1,this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const e=t.item;e&&this.isGraphicInMark(e)&&this.resetAll()},this.options=Object.assign({},oj,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}resetAll(){const{interaction:t,highlightState:e,blurState:i}=this.options;t.clearAllStatesOfTrigger(this,e,i),t.setStatedGraphics(this,[])}_getHightlightKey(t){var e;return null===(e=t.context)||void 0===e?void 0:e.groupKey}start(t){if(t&&this.isGraphicInMark(t)){const e=this._getHightlightKey(t);if(u(e))return;const{interaction:i,highlightState:s,blurState:n}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((t=>{var i;null===(i=t.getGraphics())||void 0===i||i.forEach((t=>{this._getHightlightKey(t)===e&&a.push(t)}))})),i.updateStates(this,a,r,s,n),i.setStatedGraphics(this,a)}}reset(t){if(t){if(this.isGraphicInMark(t)){const{interaction:e}=this.options,i=e.getStatedGraphics(this);t.removeState([this.options.highlightState,this.options.blurState]),e.setStatedGraphics(this,i.filter((e=>e!==t)))}}else this.resetAll()}}s1.type=i1,s1.defaultOptions=oj;const n1="element-highlight-by-key";class r1 extends s1{constructor(){super(...arguments),this.type=n1}_getHightlightKey(t){var e;return null===(e=t.context)||void 0===e?void 0:e.key}}r1.type=n1;const a1="element-highlight-by-legend",o1={highlightState:kF.STATE_HIGHLIGHT,blurState:kF.STATE_BLUR,filterType:"groupKey"};class l1 extends lj{constructor(t){super(t),this.type=a1,this.handleStart=t=>{var e,i;const s=t.event;s&&this.start(null===(i=null===(e=s.detail)||void 0===e?void 0:e.data)||void 0===i?void 0:i.id)},this.handleReset=t=>{this.resetAll()},this.options=Object.assign({},o1,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){return[{type:yD.legendItemHover,handler:this.handleStart},{type:yD.legendItemUnHover,handler:this.handleReset}]}start(t){if(t){const e=aj(this.options),{interaction:i,highlightState:s,blurState:n}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((i=>{var s;null===(s=i.getGraphics())||void 0===s||s.forEach((i=>{e(i)===t&&a.push(i)}))})),i.updateStates(this,a,r,s,n),i.setStatedGraphics(this,a)}}resetAll(){const{interaction:t,highlightState:e,blurState:i}=this.options;t.clearAllStatesOfTrigger(this,e,i),t.setStatedGraphics(this,[])}reset(t){const{highlightState:e,blurState:i,interaction:s}=this.options;if(t){const n=s.getStatedGraphics(this);n&&n.includes(t)&&(t.removeState([e,i]),s.setStatedGraphics(this,n.filter((e=>e!==t))))}else this.resetAll()}}l1.type=a1,l1.defaultOptions=o1;const h1="element-highlight-by-name",c1={highlightState:kF.STATE_HIGHLIGHT,blurState:kF.STATE_BLUR,filterType:"groupKey"};class d1 extends lj{constructor(t){super(t),this.type=h1,this.handleStart=t=>{if(this.options.shouldStart?this.options.shouldStart(t):this._filterByName(t)){const e=this._parseTargetKey(t);this.start(e)}},this.handleReset=t=>{(this.options.shouldReset?this.options.shouldReset(t):this._filterByName(t))&&this.resetAll()},this.options=Object.assign({},c1,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart},{type:this.options.triggerOff,handler:this.handleReset}]}_filterByName(t){var e;const i=Y(this.options.graphicName);return(null===(e=null==t?void 0:t.node)||void 0===e?void 0:e.name)&&i.includes(t.node.name)}_parseTargetKey(t){return this.options.parseData?this.options.parseData(t):"text"===t.node.type?t.node.attribute.text:null}start(t){if(t){const e=aj(this.options),{interaction:i,highlightState:s,blurState:n}=this.options,r=i.getStatedGraphics(this),a=[];this.getMarks().forEach((i=>{var s;null===(s=i.getGraphics())||void 0===s||s.forEach((i=>{e(i)===t&&a.push(i)}))})),i.updateStates(this,a,r,s,n),i.setStatedGraphics(this,a)}}resetAll(){const{interaction:t,highlightState:e,blurState:i}=this.options;t.clearAllStatesOfTrigger(this,e,i),t.setStatedGraphics(this,[])}reset(t){const{highlightState:e,blurState:i,interaction:s}=this.options;if(t){const n=s.getStatedGraphics(this);n&&n.includes(t)&&(t.removeState([e,i]),s.setStatedGraphics(this,n.filter((e=>e!==t))))}else this.resetAll()}}d1.type=h1,d1.defaultOptions=c1;class u1 extends FF{constructor(){super(...arguments),this.type=u1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}u1.type="image";const p1=()=>{zF(),Rz(),Lz(),kW(),dU(),hN(),wN(),QN(),jU(),cX(),iL.registerMark(u1.type,u1),nw(),NM(),iL.registerGraphicComponent("image",Sf),HK(),xH()};mj.useRegisters([aN,yN,LN,XN,kq,Cq,Pq,Nq,mq,Xq,Jq,Qq,iZ,bZ,kZ,Gq,rZ,lZ,BZ,dZ,gZ,vZ,wZ,OZ,Fq,LZ,Rq,UH,XH,qH,JH,tV,oG,rG,NZ,eJ,cJ,vJ,_J,LJ,FJ,WJ,hW,PQ,jQ,o0,OQ,HQ,h0,d0,IQ,$Q,QQ,i0,p0,f0,y0,()=>{iL.registerLayout(m0.type,m0)},p1,z0,G0,()=>{Y0(q0)},()=>{iL.registerInteractionTrigger(J0.type,J0)},()=>{iL.registerInteractionTrigger(Q0,e1)},()=>{iL.registerInteractionTrigger(a1,l1)},()=>{iL.registerInteractionTrigger(h1,d1)},()=>{iL.registerInteractionTrigger(i1,s1)},()=>{iL.registerInteractionTrigger(n1,r1)},nj,Hb,()=>{__.registerPlugin("HtmlAttributePlugin",jb)}]);class g1 extends SV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","maskShape","reverse","outlineMargin","outlinePadding","indicatorSmartInvert","liquidBackground","liquidOutline"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let f1=class extends bV{constructor(){super(...arguments),this.transformerConstructor=g1,this.type="liquid",this.seriesType=MI.liquid}};f1.type="liquid",f1.seriesType=MI.liquid,f1.transformerConstructor=g1;const m1=()=>{iN(),eq(),iL.registerChart(f1.type,f1)};class v1 extends SV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","circle","overlap","overlapLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}let y1=class extends bV{constructor(){super(...arguments),this.transformerConstructor=v1,this.type="venn",this.seriesType=MI.venn}};y1.type="venn",y1.seriesType=MI.venn,y1.transformerConstructor=v1;const _1=()=>{iN(),dq(),iL.registerChart(y1.type,y1)};class b1 extends kV{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar","bandWidthField"])}transformSpec(t){super.transformSpec(t),ZD(t)}_setDefaultXAxisSpec(t){return{orient:"bottom",type:"linear",label:{visible:!1}}}_setDefaultYAxisSpec(t){return{orient:"left",type:"linear"}}}let x1=class extends bV{constructor(){super(...arguments),this.transformerConstructor=b1,this.type="mosaic",this.seriesType=MI.mosaic,this.handleAfterStackRegion=(t,e)=>{t.getSeries().forEach((t=>{const i=t.getStackData(),s=t.getStackValue(),n=t.getStackValueField();i&&n&&(eD(e[s],n),iD(t,e[s]))}))}}_beforeInit(){this._dataSet&&MD(this._dataSet,"stackSplit",MV)}_initStack(){this._stack=new wV(this,{afterStackRegion:this.handleAfterStackRegion}),this._stack.init()}_setModelOption(){this._modelOption.getDimensionInfo=FV,this._modelOption.getDimensionInfoByValue=zV,this._modelOption.getRectByDimensionData=GV}};x1.type="mosaic",x1.seriesType=MI.mosaic,x1.transformerConstructor=b1;const S1=()=>{tN(),iN(),nN(),EV(),PV(),pq(),iL.registerChart(x1.type,x1)};class k1 extends Uz{constructor(){super(k1.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[k1.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=nW(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom<this._maxZoom))return;n=this._maxZoom}if(n===s)return;const r=n/s;if(this._zoom=n,i.resize(i.getCurrentSize().width*this._zoom,i.getCurrentSize().height*this._zoom),e&&this._container){const{scrollLeft:t,scrollTop:i}=this._container;this._container.scrollLeft=t+e.x*(r-1),this._container.scrollTop=i+e.y*(r-1)}}release(){this._container&&this._triggerEvent&&this._container.removeEventListener(this._triggerEvent,this._onWheel)}}k1.specKey="resizeZoom",k1.type="ChartResizeZoomPlugin";function A1(t,i="ChartContainer",s){const n=e.forwardRef(((i,n)=>{const r=e.useRef(null),[a,o]=e.useState(!1),{className:l,style:h,width:c,height:d,id:u}=i,p=
|
|
10
10
|
/*! *****************************************************************************
|
|
11
11
|
Copyright (c) Microsoft Corporation.
|
|
12
12
|
|